reformat gui with astyle. (#311)
authortsteven4 <tsteven4@users.noreply.github.com>
Sun, 3 Mar 2019 14:39:52 +0000 (07:39 -0700)
committerGitHub <noreply@github.com>
Sun, 3 Mar 2019 14:39:52 +0000 (07:39 -0700)
46 files changed:
gui/aboutdlg.cc
gui/aboutdlg.h
gui/advdlg.cc
gui/advdlg.h
gui/appname.h
gui/babeldata.h
gui/donate.cc
gui/donate.h
gui/dpencode.cc
gui/dpencode.h
gui/filterdata.cc
gui/filterdata.h
gui/filterdlg.cc
gui/filterdlg.h
gui/filterwidgets.cc
gui/filterwidgets.h
gui/format.cc
gui/format.h
gui/formatload.cc
gui/formatload.h
gui/gmapdlg.cc
gui/gmapdlg.h
gui/gpx.cc
gui/gpx.h
gui/help.cc
gui/help.h
gui/latlng.cc
gui/latlng.h
gui/main.cc
gui/mainwindow.cc
gui/mainwindow.h
gui/map.cc
gui/map.h
gui/optionsdlg.h
gui/preferences.cc
gui/preferences.h
gui/processwait.cc
gui/processwait.h
gui/serial_mac.cc
gui/serial_unix.cc
gui/serial_win.cc
gui/setting.h
gui/upgrade.cc
gui/upgrade.h
gui/version_mismatch.cc
gui/version_mismatch.h

index a80d9007749fdba7595d651a769b625318fb59ea..b85bd22cef437e5cb28b01e09da9a85cbc5c566d 100644 (file)
 #include "appname.h"
 #include "upgrade.h"
 
-AboutDlg::AboutDlg(QWidget *parent, const QString &ver1,
-       const QString &ver2, const QString& installationId): QDialog(parent)
+AboutDlg::AboutDlg(QWidget* parent, const QString& ver1,
+                   const QString& ver2, const QString& installationId): QDialog(parent)
 {
   ui_.setupUi(this);
-  QTextDocument *doc = ui_.textEdit->document();
+  QTextDocumentdoc = ui_.textEdit->document();
   ui_.textEdit->setReadOnly(true);
   QString tt = doc->toHtml();
   tt.replace(QRegExp("\\$appname\\$"),  QString(appName));
@@ -37,9 +37,9 @@ AboutDlg::AboutDlg(QWidget *parent, const QString &ver1,
   tt.replace(QRegExp("\\$installationId\\$"),  installationId);
 
   // Not localized as it should never be seen.
-  tt.replace(QRegExp("\\$upgradetestmode\\$"),  
-    UpgradeCheck::isTestMode() ? "**Upgrade test mode**" : "");
-      
+  tt.replace(QRegExp("\\$upgradetestmode\\$"),
+             UpgradeCheck::isTestMode() ? "**Upgrade test mode**" : "");
+
   doc->setHtml(tt);
   QTextCursor cur(doc);
   cur.setPosition(0);
index 171ec647154eadbecd40704148ebe2cbda79e9c5..25610dea3f15e43a81d95b200b7538a324c9e8e2 100644 (file)
 
 #include "ui_aboutui.h"
 
-class AboutDlg: public QDialog {
- public:
-  AboutDlg(QWidget *parent,  const QString &ver1,
-     const QString &ver2, const QString &installationId);
+class AboutDlg: public QDialog
+{
+public:
+  AboutDlg(QWidget* parent,  const QString& ver1,
+           const QString& ver2, const QString& installationId);
 
- private:
+private:
   Ui_AboutDlg  ui_;
 
 };
index 334e16c7ed8003a4ef9519fcf206660920a03449..c95a5c275095e41aa489b724ed3a393ee8726ef1 100644 (file)
@@ -27,9 +27,9 @@
 
 //------------------------------------------------------------------------
 AdvDlg::AdvDlg(QWidget* parent,
-              bool &synthShortNames,
-              bool &previewGmap,
-              int  &debugLevel):
+               bool& synthShortNames,
+               bool& previewGmap,
+               int&  debugLevel):
   QDialog(parent),
   synthShortNames_(synthShortNames),
   previewGmap_(previewGmap),
index 0cec3d216e4f4d4aa59d840f29cc55eb1b52e99b..3c21d088ea1c8172fa5048bb31e47ba4ec54aeb9 100644 (file)
 
 #include "ui_advui.h"
 
-class AdvDlg: public QDialog {
+class AdvDlg: public QDialog
+{
   Q_OBJECT
-  
+
 public:
-  AdvDlg(QWidget* parent, 
-   bool &synthShortNames_,
-   bool &previewGmap_,
-   int   &debugLevel_);
-  QPushButton* formatButton() { return ui_.formatButton; };
+  AdvDlg(QWidget* parent,
+         bool& synthShortNames_,
+         bool& previewGmap_,
+         int&   debugLevel_);
+  QPushButton* formatButton()
+  {
+    return ui_.formatButton;
+  };
 
 private:
   Ui_AdvUi ui_;
-  bool &synthShortNames_;
-  bool &previewGmap_;
-  int  &debugLevel_;
+  boolsynthShortNames_;
+  boolpreviewGmap_;
+  int&  debugLevel_;
 
- protected:
+protected:
 
- private slots:
+private slots:
   void acceptClicked();
   void rejectClicked();
 };
index 162531a2aa36589e4dbf2204319d3566de3298bb..de76b2c70a9d9c1a2bbfb9f624a07a282a78e0d3 100644 (file)
@@ -21,6 +21,6 @@
 //
 #ifndef APPNAME_H
 #define APPNAME_H
-static const char *appName = "GPSBabel";
+static const charappName = "GPSBabel";
 #endif
 
index 0619d69c7104aa2e367e637d6c34e3f855c316f7..2bd3c62626761cd7a096b09acf7ffcee2f51b2b8 100644 (file)
 #include "setting.h"
 
 
-class BabelData {
+class BabelData
+{
 public:
-  BabelData(): 
+  BabelData():
     inputType_(fileType_),
     inputFileFormat_(QString()),
     inputDeviceFormat_(QString()),
@@ -71,19 +72,22 @@ public:
     donateSplashed_(QDateTime(QDate(2010, 1, 1), QTime(0, 0, 0)))
   {
   };
-  
-  void saveSettings(QSettings &st) {
+
+  void saveSettings(QSettings& st)
+  {
     SettingGroup sg;
     makeSettingGroup(sg);
     sg.saveSettings(st);
   }
-  void restoreSettings(QSettings &st) {
+  void restoreSettings(QSettings& st)
+  {
     SettingGroup sg;
     makeSettingGroup(sg);
     sg.restoreSettings(st);
   }
 
-  void makeSettingGroup(SettingGroup &sg) {
+  void makeSettingGroup(SettingGroup& sg)
+  {
     sg.addVarSetting(new IntSetting("app.inputType", inputType_));
     sg.addVarSetting(new StringSetting("app.inputFileFormat", inputFileFormat_));
     sg.addVarSetting(new StringSetting("app.inputDeviceFormat", inputDeviceFormat_));
@@ -142,7 +146,7 @@ public:
   bool xlateWayPts_;
   bool xlateRoutes_;
   bool xlateTracks_;
-  
+
   int outputType_;
   QString outputFileFormat_;
   QString outputDeviceFormat_;
index 807635cbad6d9abae7cca758ed5a3ed12d5be05f..8fe475e86befc3c7075c1d9759083fb2a8f3b30a 100644 (file)
@@ -24,7 +24,7 @@
 #include <QDesktopServices>
 
 // A completely simple QDialog, in a class of its own for layout.
-Donate::Donate(QWidget *parent) : QDialog(parent)
+Donate::Donate(QWidgetparent) : QDialog(parent)
 {
   ui_.setupUi(this);
   connect(ui_.contributeButton, SIGNAL(clicked()), this, SLOT(contributeClicked()));
index ae4c8cf661756103a345977c9e245e2008585d02..2a4084a83af4f43996896e61679e58fdc5972678 100644 (file)
 
 #include "ui_donate.h"
 
-class Donate: public QDialog {
- Q_OBJECT
-
- public:
-  Donate(QWidget *parent);
-  void showNever(bool f)  { 
+class Donate: public QDialog
+{
+  Q_OBJECT
+
+public:
+  Donate(QWidget* parent);
+  void showNever(bool f)
+  {
     ui_.neverAgain->setVisible(f);
     ui_.textLine2->setVisible(f);
   }
-  bool neverAgain() { return ui_.neverAgain->isChecked(); }
+  bool neverAgain()
+  {
+    return ui_.neverAgain->isChecked();
+  }
 
- private:
+private:
   Ui_Donate  ui_;
 
- private slots:
+private slots:
   void contributeClicked();
 
 };
index 4444d8af935b2eefdb7c8c4987e4fcb615ba3e35..81c0ab728fdeedfc467042f138103d48e2cca282 100644 (file)
@@ -2,7 +2,7 @@
 // $Id: dpencode.cpp,v 1.3 2009-09-08 16:06:32 robertl Exp $
 //------------------------------------------------------------------------
 //
-//  Original in JavaScript: 
+//  Original in JavaScript:
 //  PolylineEncoder.js copyright Mark McClure  April/May 2007
 //
 //  Translated to C++
@@ -38,32 +38,37 @@ using std::string;
 PolylineEncoder::PolylineEncoder(int numLevels, double zoomFactor, double vs):
   numLevels(numLevels), verySmall(vs)
 {
-  if (verySmall <=0.0)
+  if (verySmall <=0.0) {
     verySmall = 1.0E-5;
-  for(int i = 0; i < numLevels; i++)
+  }
+  for (int i = 0; i < numLevels; i++) {
     zoomLevelBreaks.push_back(verySmall*pow(zoomFactor, numLevels-i-1));
+  }
 }
 
 //------------------------------------------------------------------------
 class IntervalPair
 {
 public:
-  IntervalPair(int i0, int i1): i0(i0), i1(i1) {
+  IntervalPair(int i0, int i1): i0(i0), i1(i1)
+  {
   }
   int  i0, i1;
 };
 
 //------------------------------------------------------------------------
-static double hypotenuse(double a, double b){
+static double hypotenuse(double a, double b)
+{
   return sqrt(a*a + b*b);
 }
 //------------------------------------------------------------------------
-static double hdist(const LatLng &a, const LatLng &b) {
+static double hdist(const LatLng& a, const LatLng& b)
+{
   return hypotenuse(a.lat()-b.lat(), a.lng()-b.lng());
 }
 
 //------------------------------------------------------------------------
-static string encodeNumber(int num) 
+static string encodeNumber(int num)
 {
   string encodeString = "";
   while (num >= 0x20) {
@@ -76,29 +81,30 @@ static string encodeNumber(int num)
 
 //------------------------------------------------------------------------
 // This one is Google's verbatim.
-static string encodeSignedNumber (int num) 
+static string encodeSignedNumber(int num)
 {
   int sgn_num = num << 1;
   if (num < 0) {
     sgn_num = ~(sgn_num);
   }
-  return(encodeNumber(sgn_num));
+  return (encodeNumber(sgn_num));
 }
 
 //------------------------------------------------------------------------
-int roundToInt(double x) {
+int roundToInt(double x)
+{
   return (x>0.0) ? int(x+0.5) : int(x-0.5);
 }
 //------------------------------------------------------------------------
-void PolylineEncoder::createEncodings(string &encoded_points,
-                                     const vector <LatLng> &points,
-                                     const vector <double> &dists)
+void PolylineEncoder::createEncodings(stringencoded_points,
+                                      const vector <LatLng>& points,
+                                      const vector <double>& dists)
 {
   encoded_points = "";;
   int plat = 0;
   int plng = 0;
-  for(unsigned int i = 0; i < points.size(); i++) {
-    if(dists[i] >= 0.0 || i == 0 || i == points.size()-1) {
+  for (unsigned int i = 0; i < points.size(); i++) {
+    if (dists[i] >= 0.0 || i == 0 || i == points.size()-1) {
       int late5 = roundToInt(points[i].lat() * 1e5);
       int lnge5 = roundToInt(points[i].lng() * 1e5);
       int dlat = late5 - plat;
@@ -118,8 +124,8 @@ void PolylineEncoder::createEncodings(string &encoded_points,
 int PolylineEncoder::computeLevel(double dd)
 {
   int lev = 0;
-  if(dd > verySmall) {
-    while(dd < zoomLevelBreaks[lev]) {
+  if (dd > verySmall) {
+    while (dd < zoomLevelBreaks[lev]) {
       lev++;
     }
   }
@@ -129,12 +135,12 @@ int PolylineEncoder::computeLevel(double dd)
 // Now we can use the previous function to march down the list
 // of points and encode the levels.  Like createEncodings, we
 // ignore points whose distance (in dists) is undefined.
-void PolylineEncoder::encodeLevels(string &encoded_levels, const vector<LatLng> &points, const vector<double>&dists)
+void PolylineEncoder::encodeLevels(string& encoded_levels, const vector<LatLng>& points, const vector<double>& dists)
 {
   encoded_levels = "";
   encoded_levels += encodeNumber(numLevels-1);
   for (unsigned int i=1; i<points.size()-1; i++) {
-    if(dists[i] >= 0.0) {
+    if (dists[i] >= 0.0) {
       encoded_levels += encodeNumber(numLevels-computeLevel(dists[i])-1);
     }
   }
@@ -143,24 +149,21 @@ void PolylineEncoder::encodeLevels(string &encoded_levels, const vector<LatLng>
 
 
 //------------------------------------------------------------------------
-double PolylineEncoder::distance(const LatLng &p0, const LatLng &p1, const LatLng &p2) 
+double PolylineEncoder::distance(const LatLng& p0, const LatLng& p1, const LatLng& p2)
 {
   double out = 0.0;
   if (p1.lat() == p2.lat() && p1.lng() == p2.lng()) {
     out = hdist(p2, p0);
-  }
-  else {
+  } else {
     double dlat = (p2.lat()-p1.lat());
     double dlng = (p2.lng()-p1.lng());
     double u = ((p0.lat()-p1.lat())*dlat+(p0.lng()-p1.lng())*dlng)/(dlat*dlat + dlng*dlng);
-  
+
     if (u <= 0) {
       out = hdist(p0, p1);
-    }
-    else if(u >= 1) {
+    } else if (u >= 1) {
       out = hdist(p0, p2);
-    }
-    else {
+    } else {
       out = hdist(p0, LatLng(p1.lat() + u*dlat, p1.lng() + u*dlng));
     }
   }
@@ -168,7 +171,7 @@ double PolylineEncoder::distance(const LatLng &p0, const LatLng &p1, const LatLn
 }
 
 //------------------------------------------------------------------------
-void PolylineEncoder::dpEncode(string &encPts, string &encLevels, const vector<LatLng> &points)
+void PolylineEncoder::dpEncode(string& encPts, string& encLevels, const vector<LatLng>& points)
 {
   if (points.size() < 2) {
     encPts = encLevels = "";  // no solution here.
@@ -177,23 +180,23 @@ void PolylineEncoder::dpEncode(string &encPts, string &encLevels, const vector<L
   }
   stack <IntervalPair> stk;
   vector <double>  dists(points.size(), -1.0);
-  
+
   stk.push(IntervalPair(0, int(points.size())-1));
   while (!stk.empty()) {
-    
+
     IntervalPair current = stk.top();
     stk.pop();
-    
+
     double maxDist = -1.0;
     int maxLoc = -1;
     for (int i=current.i0+1; i<current.i1; i++) {
       double dist = this->distance(points[i], points[current.i0], points[current.i1]);
-      if(dist > maxDist) {
-       maxDist = dist;
-       maxLoc = i;
+      if (dist > maxDist) {
+        maxDist = dist;
+        maxLoc = i;
       }
     }
-    if(maxDist > this->verySmall) {
+    if (maxDist > this->verySmall) {
       dists[maxLoc] = maxDist;
       stk.push(IntervalPair(current.i0, maxLoc));
       stk.push(IntervalPair(maxLoc, current.i1));
index c18d80646921eebdb23b57d3b49fb22f7cac9c51..e3c95ddda551fcdb15db35e9f3e000febfe1b1bf 100644 (file)
@@ -30,19 +30,20 @@ using std::vector;
 using std::string;
 
 
-class PolylineEncoder {
+class PolylineEncoder
+{
 public:
   PolylineEncoder(int numLevels=19, double zoomFactor=2.0, double verySmall = 0.00001);
-  void dpEncode(string &encPts, string &encLevels, const vector<LatLng> &points);
-  
+  void dpEncode(string& encPts, string& encLevels, const vector<LatLng>& points);
+
 private:
 
   int computeLevel(double dd);
-  double distance(const LatLng &, const LatLng &, const LatLng &);
-  void encodeLevels(string &, const vector<LatLng> &points, const vector<double>&dists);
-  void createEncodings(string &encoded_points, 
-                      const vector <LatLng> &points, 
-                      const vector <double> &dists);
+  double distance(const LatLng&, const LatLng&, const LatLng&);
+  void encodeLevels(string&, const vector<LatLng>& points, const vector<double>& dists);
+  void createEncodings(string& encoded_points,
+                       const vector <LatLng>& points,
+                       const vector <double>& dists);
 
   int numLevels;
   double verySmall;
index 6cf62d9c9284ee0c9d7fbbaa8219b3fa379442c5..fb96fc5fb7e6a474abb0eb7a1bb7859d1c6a0511 100644 (file)
 QStringList WayPtsFilterData::makeOptionString()
 {
   QStringList args;
-  if (!inUse_)
+  if (!inUse_) {
     return args;
+  }
 
   if (radius) {
     args << QString("-x");
     args << QString("radius,distance=%1%2,lat=%3,lon=%4")
-      .arg(radiusVal).arg("MK"[radiusUnit]).arg(latVal, 0, 'f', 8).arg(longVal, 0, 'f', 8);
+         .arg(radiusVal).arg("MK"[radiusUnit]).arg(latVal, 0, 'f', 8).arg(longVal, 0, 'f', 8);
   }
   if (duplicates && (shortNames ^ locations)) {
     args << QString("-x");
     QString s = "duplicate";
-    if (shortNames)
+    if (shortNames) {
       s += ",shortname";
-    if (locations)
+    }
+    if (locations) {
       s += ",location";
+    }
     args << s;
   }
 
@@ -52,77 +55,96 @@ QStringList WayPtsFilterData::makeOptionString()
 }
 
 //------------------------------------------------------------------------
-static QString optionDate(const QDateTime &dt, bool useLocal)
+static QString optionDate(const QDateTimedt, bool useLocal)
 {
   QDateTime d;
   if (useLocal) {
     d = dt.toLocalTime();
-  }
-  else {
+  } else {
     d = dt.toUTC();
   }
 
   QDate date = d.date();
   QTime time = d.time();
   QString s = QString("%1%2%3%4%5%6")
-    .arg(date.year(),   4, 10, QChar('0'))
-    .arg(date.month(),  2, 10, QChar('0'))
-    .arg(date.day(),    2, 10, QChar('0'))
-    .arg(time.hour(),   2, 10, QChar('0'))
-    .arg(time.minute(), 2, 10, QChar('0'))
-    .arg(time.second(), 2, 10, QChar('0'));
+              .arg(date.year(),   4, 10, QChar('0'))
+              .arg(date.month(),  2, 10, QChar('0'))
+              .arg(date.day(),    2, 10, QChar('0'))
+              .arg(time.hour(),   2, 10, QChar('0'))
+              .arg(time.minute(), 2, 10, QChar('0'))
+              .arg(time.second(), 2, 10, QChar('0'));
   return s;
 }
 
 //------------------------------------------------------------------------
 QStringList TrackFilterData::makeOptionString()
 {
-  static const char *fixStrings[] = {"none", "pps", "dgpss", "3d", "2d"}; // match with designer!
+  static const charfixStrings[] = {"none", "pps", "dgpss", "3d", "2d"}; // match with designer!
   QStringList args;
-  if (!inUse_)
+  if (!inUse_) {
     return args;
+  }
 
   QString s;
-  if (GPSFixes) s += QString(",fix=%1").arg(fixStrings[GPSFixesVal]);
-  if (course)   s += ",course";
-  if (speed)    s += ",speed";
-  if (pack)     s += ",pack";
-  if (merge)    s += ",merge";
+  if (GPSFixes) {
+    s += QString(",fix=%1").arg(fixStrings[GPSFixesVal]);
+  }
+  if (course) {
+    s += ",course";
+  }
+  if (speed) {
+    s += ",speed";
+  }
+  if (pack) {
+    s += ",pack";
+  }
+  if (merge) {
+    s += ",merge";
+  }
   if (pack || merge) {
     if (splitByDate)  {
       s += ",split";
     }
     if (splitByTime)  {
       s += ",split";
-      if (splitTime > 0)
-       s += QString("=%1%2").arg(splitTime).arg("mhd"[splitTimeUnit]);
+      if (splitTime > 0) {
+        s += QString("=%1%2").arg(splitTime).arg("mhd"[splitTimeUnit]);
+      }
     }
     if (splitByDistance && splitDist > 0) {
       double d = splitDist;
       char u = ' ';
       if (splitDistUnit == 0) { // ft.
-       d /= 5280.0;  u = 'm';
-      }
-      else if (splitDistUnit == 1) { //m
-       d /= 1000.0;  u = 'k';
-      }
-      else if (splitDistUnit == 2) { //km
-       u = 'k';
-      }
-      else if (splitDistUnit == 3) { //m
-       u = 'm';
+        d /= 5280.0;
+        u = 'm';
+      } else if (splitDistUnit == 1) { //m
+        d /= 1000.0;
+        u = 'k';
+      } else if (splitDistUnit == 2) { //km
+        u = 'k';
+      } else if (splitDistUnit == 3) { //m
+        u = 'm';
       }
       s += QString(",sdistance=%1%2").arg(d).arg(u);
     }
   }
 
-  if (start)    s += QString(",start=%1").arg(optionDate(startTime, TZ));
-  if (stop)     s += QString(",stop=%1").arg(optionDate(stopTime, TZ));
-  if (move)     s += QString(",move=%1d%2h%3m%4s").arg(days).arg(hours).arg(mins).arg(secs);
-  if (title)    s += QString(",title=%1").arg(titleString);
+  if (start) {
+    s += QString(",start=%1").arg(optionDate(startTime, TZ));
+  }
+  if (stop) {
+    s += QString(",stop=%1").arg(optionDate(stopTime, TZ));
+  }
+  if (move) {
+    s += QString(",move=%1d%2h%3m%4s").arg(days).arg(hours).arg(mins).arg(secs);
+  }
+  if (title) {
+    s += QString(",title=%1").arg(titleString);
+  }
 
-  if (s.length())
+  if (s.length()) {
     args << "-x" << "track" + s;
+  }
 
   return args;
 }
@@ -131,11 +153,16 @@ QStringList TrackFilterData::makeOptionString()
 QStringList RtTrkFilterData::makeOptionString()
 {
   QStringList args;
-  if (!inUse_)
+  if (!inUse_) {
     return args;
+  }
 
-  if (reverse_)  args << QString("-x") << QString("reverse");
-  if (simplify_) args << QString("-x") << QString("simplify,count=%1").arg(limitTo_);
+  if (reverse_) {
+    args << QString("-x") << QString("reverse");
+  }
+  if (simplify_) {
+    args << QString("-x") << QString("simplify,count=%1").arg(limitTo_);
+  }
 
   return args;
 }
@@ -144,22 +171,31 @@ QStringList RtTrkFilterData::makeOptionString()
 QStringList MiscFltFilterData::makeOptionString()
 {
   QStringList args;
-  if (!inUse_)
+  if (!inUse_) {
     return args;
+  }
 
   if (nukeRoutes_ || nukeTracks_ || nukeWaypoints_) {
     args << QString("-x");
     QString s = "nuketypes";
-    if (nukeRoutes_) s += ",routes";
-    if (nukeTracks_) s += ",tracks";
-    if (nukeWaypoints_) s += ",waypoints";
+    if (nukeRoutes_) {
+      s += ",routes";
+    }
+    if (nukeTracks_) {
+      s += ",tracks";
+    }
+    if (nukeWaypoints_) {
+      s += ",waypoints";
+    }
     args << s;
   }
 
-  if (swap_) args << "-x" << "swap";
+  if (swap_) {
+    args << "-x" << "swap";
+  }
 
   if (transform_) {
-    static const char *xformStr[] = {
+    static const charxformStr[] = {
       "wpt=trk",
       "trk=rte",
       "rte=wpt",
@@ -169,7 +205,9 @@ QStringList MiscFltFilterData::makeOptionString()
     };
     args << QString("-x");
     QString s= QString("transform,%1").arg(xformStr[transformVal_]);
-    if (del_) s += ",del";
+    if (del_) {
+      s += ",del";
+    }
     args << s;
   }
   return args;
index d7d1cfed825b14471c1b0ecf98aef2cfc22b22aa..5aada4ebdb423f376442e700c852e1161ca408fb 100644 (file)
 
 //------------------------------------------------------------------------
 
-class FilterData {
+class FilterData
+{
 public:
   FilterData(): inUse_(true) {};
   virtual ~FilterData() {};
 
-  void saveSettings(QSettings &st) {
+  void saveSettings(QSettings& st)
+  {
     SettingGroup sg;
     makeSettingGroup(sg);
     sg.saveSettings(st);
   }
-  void restoreSettings(QSettings &st) {
+  void restoreSettings(QSettings& st)
+  {
     SettingGroup sg;
     makeSettingGroup(sg);
     sg.restoreSettings(st);
   }
-  virtual void makeSettingGroup(SettingGroup &sg) = 0;
+  virtual void makeSettingGroup(SettingGroupsg) = 0;
   virtual QStringList makeOptionString() = 0;
 
 public:
@@ -53,21 +56,22 @@ public:
 };
 //------------------------------------------------------------------------
 
-class TrackFilterData: public FilterData  {
- public:
+class TrackFilterData: public FilterData
+{
+public:
   TrackFilterData(): FilterData(), title(false), titleString(QString()),
-                    move(false),  days(0), hours(0), mins(0), secs(0),
-                    TZ(false),
-                    start(false),
-                    stop(false),
-                    pack(false), merge(false), split(false), 
-                    GPSFixes(false), GPSFixesVal(0),
-                    splitByDate(false),
-                    splitByTime(false),
-                    splitByDistance(false),
-                    course(false), speed(false),
-                    splitTime(0), splitTimeUnit(0),
-                    splitDist(0), splitDistUnit(0)
+    move(false),  days(0), hours(0), mins(0), secs(0),
+    TZ(false),
+    start(false),
+    stop(false),
+    pack(false), merge(false), split(false),
+    GPSFixes(false), GPSFixesVal(0),
+    splitByDate(false),
+    splitByTime(false),
+    splitByDistance(false),
+    course(false), speed(false),
+    splitTime(0), splitTimeUnit(0),
+    splitDist(0), splitDistUnit(0)
   {
     titleString = "ACTIVE LOG #%Y%m%d";
     stopTime = QDateTime::currentDateTime();
@@ -75,7 +79,7 @@ class TrackFilterData: public FilterData  {
     startTime = stopTime.addMonths(-6);
     startTime.setTime(QTime(0, 0, 1));
   }
-  virtual void makeSettingGroup(SettingGroup &sg)
+  virtual void makeSettingGroup(SettingGroupsg)
   {
     sg.addVarSetting(new BoolSetting("trks.inUse", inUse_));
     sg.addVarSetting(new BoolSetting("trks.GPSFixes", GPSFixes));
@@ -106,8 +110,8 @@ class TrackFilterData: public FilterData  {
     sg.addVarSetting(new IntSetting("trks.splitDistUnit", splitDistUnit));
   }
   virtual QStringList makeOptionString();
-  
- public:
+
+public:
   bool title;
   QString titleString;
   bool move;
@@ -128,19 +132,20 @@ class TrackFilterData: public FilterData  {
 
 //------------------------------------------------------------------------
 
-class WayPtsFilterData: public FilterData  {
- public:
-  WayPtsFilterData(): FilterData(), 
-                     duplicates(false), shortNames(true), locations(false), 
-                     position(false), radius(false), sort(false),
-                     positionVal(0.0), radiusVal(0.0),
-                     longVal(0.0), latVal(0.0),
-                     positionUnit(0), radiusUnit(0)
-    {
-    }
-  
+class WayPtsFilterData: public FilterData
+{
+public:
+  WayPtsFilterData(): FilterData(),
+    duplicates(false), shortNames(true), locations(false),
+    position(false), radius(false), sort(false),
+    positionVal(0.0), radiusVal(0.0),
+    longVal(0.0), latVal(0.0),
+    positionUnit(0), radiusUnit(0)
+  {
+  }
+
   virtual QStringList makeOptionString();
-  virtual void makeSettingGroup(SettingGroup &sg)
+  virtual void makeSettingGroup(SettingGroupsg)
   {
     sg.addVarSetting(new BoolSetting("wpts.inUse", inUse_));
     sg.addVarSetting(new BoolSetting("wpts.radius", radius));
@@ -158,7 +163,7 @@ class WayPtsFilterData: public FilterData  {
   }
 
 
- public:
+public:
   bool duplicates, shortNames, locations, position, radius, sort;
   double positionVal;
   double radiusVal;
@@ -167,44 +172,47 @@ class WayPtsFilterData: public FilterData  {
 };
 
 //------------------------------------------------------------------------
-class RtTrkFilterData: public FilterData  {
- public:
-  RtTrkFilterData(): FilterData(), 
-         simplify_(false),
-         reverse_(false),
-         limitTo_(100)
-    {
-    }
-  
+class RtTrkFilterData: public FilterData
+{
+public:
+  RtTrkFilterData(): FilterData(),
+    simplify_(false),
+    reverse_(false),
+    limitTo_(100)
+  {
+  }
+
   virtual QStringList makeOptionString();
-  virtual void makeSettingGroup(SettingGroup &sg) {
+  virtual void makeSettingGroup(SettingGroup& sg)
+  {
     sg.addVarSetting(new BoolSetting("rttrk.inUse", inUse_));
     sg.addVarSetting(new BoolSetting("rttrk.reverse", reverse_));
     sg.addVarSetting(new BoolSetting("rttrk.simplify", simplify_));
     sg.addVarSetting(new IntSetting("rttrk.limitTo", limitTo_));
   }
 
- public:
+public:
   bool simplify_, reverse_;
   int limitTo_;
 };
 
 //------------------------------------------------------------------------
-class MiscFltFilterData: public FilterData  {
- public:
-  MiscFltFilterData(): FilterData(), 
-           nukeRoutes_(false),
-           nukeTracks_(false),
-           nukeWaypoints_(false),
-           transform_(false),
-           del_(false),
-           swap_(false),
-           transformVal_(0)
-    {
-    }
-  
+class MiscFltFilterData: public FilterData
+{
+public:
+  MiscFltFilterData(): FilterData(),
+    nukeRoutes_(false),
+    nukeTracks_(false),
+    nukeWaypoints_(false),
+    transform_(false),
+    del_(false),
+    swap_(false),
+    transformVal_(0)
+  {
+  }
+
   virtual QStringList makeOptionString();
-  virtual void makeSettingGroup(SettingGroup &sg)
+  virtual void makeSettingGroup(SettingGroupsg)
   {
     sg.addVarSetting(new BoolSetting("mscflt.nukeRoutes", nukeRoutes_));
     sg.addVarSetting(new BoolSetting("mscflt.nukeTracks", nukeTracks_));
@@ -216,7 +224,7 @@ class MiscFltFilterData: public FilterData  {
     sg.addVarSetting(new BoolSetting("mscflt.swap", swap_));
   }
 
- public:
+public:
   bool nukeRoutes_, nukeTracks_, nukeWaypoints_;
   bool transform_, del_, swap_;
   int transformVal_;
@@ -227,7 +235,7 @@ class MiscFltFilterData: public FilterData  {
 //
 class AllFiltersData
 {
- public:
+public:
   AllFiltersData()
   {
     defaultAll();
@@ -236,18 +244,21 @@ class AllFiltersData
     filters << &wayPtsFilterData;
     filters << &rtTrkFilterData;
   }
-  
-  void defaultAll() {
+
+  void defaultAll()
+  {
     miscFltFilterData = MiscFltFilterData();
     trackFilterData = TrackFilterData();
     wayPtsFilterData = WayPtsFilterData();
     rtTrkFilterData = RtTrkFilterData();
   }
 
-  QStringList getAllFilterStrings() {
+  QStringList getAllFilterStrings()
+  {
     QStringList args;
-    for (int i=0; i<filters.size(); i++) 
+    for (int i=0; i<filters.size(); i++) {
       args << filters[i]->makeOptionString();
+    }
     return args;
   }
 
@@ -255,7 +266,7 @@ class AllFiltersData
   WayPtsFilterData wayPtsFilterData;
   RtTrkFilterData rtTrkFilterData;
   MiscFltFilterData miscFltFilterData;
-  QList<FilterData *>filters;
+  QList<FilterData*>filters;
 };
 
 
index 2351a2ed3c84921f945ebd96d1b4aaa247d8815d..605eb83479e7fd03d5af8286d3262f33d9eb04ea 100644 (file)
 
 int FilterDialog::lastPage_ = 0;
 
-FilterDialog::FilterDialog(QWidget*parent, AllFiltersData &fd): QDialog(parent), fd_(fd)
+FilterDialog::FilterDialog(QWidget* parent, AllFiltersData& fd): QDialog(parent), fd_(fd)
 {
   ui_.setupUi(this);
   ui_.filterList->clear();
 
   widgetStack_ = new QStackedWidget(ui_.frame);
-  QHBoxLayout *layout = new QHBoxLayout(ui_.frame);
+  QHBoxLayoutlayout = new QHBoxLayout(ui_.frame);
   layout->addWidget(widgetStack_);
   layout->setContentsMargins(2, 2, 2, 2);
 
   addFilterPage(tr("Tracks"),
-               new TrackWidget(widgetStack_, fd.trackFilterData), &fd.trackFilterData.inUse_);
+                new TrackWidget(widgetStack_, fd.trackFilterData), &fd.trackFilterData.inUse_);
 
   addFilterPage(tr("Waypoints"),
-               new WayPtsWidget(widgetStack_, fd.wayPtsFilterData), &fd.wayPtsFilterData.inUse_);
+                new WayPtsWidget(widgetStack_, fd.wayPtsFilterData), &fd.wayPtsFilterData.inUse_);
 
   addFilterPage(tr("Routes & Tracks"),
-               new RtTrkWidget(widgetStack_, fd.rtTrkFilterData), &fd.rtTrkFilterData.inUse_);
+                new RtTrkWidget(widgetStack_, fd.rtTrkFilterData), &fd.rtTrkFilterData.inUse_);
 
   addFilterPage(tr("Miscellaneous"),
-               new MiscFltWidget(widgetStack_, fd.miscFltFilterData), &fd.miscFltFilterData.inUse_);
+                new MiscFltWidget(widgetStack_, fd.miscFltFilterData), &fd.miscFltFilterData.inUse_);
 
   connect(ui_.filterList, SIGNAL(currentRowChanged(int)),
-         this, SLOT(pageSelectionChanged(int)));
+          this, SLOT(pageSelectionChanged(int)));
 
-  connect(ui_.filterList, SIGNAL(itemClicked(QListWidgetItem *)),
-         this, SLOT(itemClickedX(QListWidgetItem*)));
+  connect(ui_.filterList, SIGNAL(itemClicked(QListWidgetItem*)),
+          this, SLOT(itemClickedX(QListWidgetItem*)));
 
   connect(ui_.helpButton, SIGNAL(clicked()), this, SLOT(helpX()));
   connect(ui_.resetButton, SIGNAL(clicked()), this, SLOT(resetX()));
@@ -72,9 +72,9 @@ FilterDialog::FilterDialog(QWidget*parent, AllFiltersData &fd): QDialog(parent),
 
 
 //------------------------------------------------------------------------
-void FilterDialog::addFilterPage(const QString &name, FilterWidget *fw, bool*use)
+void FilterDialog::addFilterPage(const QString& name, FilterWidget* fw, bool* use)
 {
-  QListWidgetItem *it = new QListWidgetItem(name);
+  QListWidgetItemit = new QListWidgetItem(name);
   it->setCheckState(*use? Qt::Checked:Qt::Unchecked);
   fw->setEnabled(*use);
   ui_.filterList->addItem(it);
@@ -84,7 +84,7 @@ void FilterDialog::addFilterPage(const QString &name, FilterWidget *fw, bool*use
 }
 
 //------------------------------------------------------------------------
-void FilterDialog::itemClickedX(QListWidgetItem *it)
+void FilterDialog::itemClickedX(QListWidgetItemit)
 {
   int row = ui_.filterList->row(it);
   bool b = (it->checkState() == Qt::Checked);
@@ -101,9 +101,9 @@ void FilterDialog::pageSelectionChanged(int i)
 void FilterDialog::resetX()
 {
   int ret = QMessageBox::warning
-    (this, QString(appName),
-     tr("Are you sure you want to reset all filter options to default values?"),
-     QMessageBox::Yes | QMessageBox::No);
+            (this, QString(appName),
+             tr("Are you sure you want to reset all filter options to default values?"),
+             QMessageBox::Yes | QMessageBox::No);
 
   if (ret == QMessageBox::Yes) {
     fd_.defaultAll();
index fa93e1178e72c304dc986be9603408c60badc124..762f897bcb5a8f6773f1b31a3387e8d7a376f4fe 100644 (file)
 
 class FilterDialog: public QDialog
 {
-Q_OBJECT
- public:
FilterDialog(QWidget *parent, AllFiltersData &fd_);
+  Q_OBJECT
+public:
 FilterDialog(QWidget* parent, AllFiltersData& fd_);
   ~FilterDialog() {}
 
   void runDialog();
-  
 
- private:
+
+private:
   static int lastPage_;
-  QList <FilterWidget *>pages_;
-  QList <bool *>usePages_;
-  QStackedWidget *widgetStack_;
+  QList <FilterWidget*>pages_;
+  QList <bool*>usePages_;
+  QStackedWidgetwidgetStack_;
   Ui_FilterDlg ui_;
-  AllFiltersData &fd_;
+  AllFiltersDatafd_;
 
-  void addFilterPage(const QString & name, FilterWidget *w, bool *);
+  void addFilterPage(const QString& name, FilterWidget* w, bool*);
 
 private slots:
   void pageSelectionChanged(int);
-  void itemClickedX(QListWidgetItem *);
+  void itemClickedX(QListWidgetItem*);
   void resetX();
   void helpX();
 };
index 655e218731a6e6d77bb5c11278536508770a0546..3cd78f42f27b8e73a6a93f0e7a18b778e391f399 100644 (file)
 
 
 //------------------------------------------------------------------------
-TrackWidget::TrackWidget(QWidget *parent, TrackFilterData &tfd): FilterWidget(parent) , tfd(tfd)
+TrackWidget::TrackWidget(QWidget* parent, TrackFilterData& tfd): FilterWidget(parent), tfd(tfd)
 {
   ui.setupUi(this);
 
   // Checkbox interlocks
   addCheckEnabler(ui.titleCheck, ui.titleText);
   addCheckEnabler(ui.moveCheck,
-                 (QList<QWidget *> ()
-                  << ui.daysLabel << ui.daysSpin
-                  << ui.hoursLabel<< ui.hoursSpin
-                  << ui.minsLabel << ui.minsSpin
-                  << ui.secsLabel << ui.secsSpin));
+                  (QList<QWidget*> ()
+                   << ui.daysLabel << ui.daysSpin
+                   << ui.hoursLabel<< ui.hoursSpin
+                   << ui.minsLabel << ui.minsSpin
+                   << ui.secsLabel << ui.secsSpin));
   addCheckEnabler(ui.startCheck,    ui.startEdit);
   addCheckEnabler(ui.stopCheck,     ui.stopEdit);
   addCheckEnabler(ui.GPSFixesCheck, ui.GPSFixesCombo);
 
-  addCheckEnabler(ui.splitTimeCheck, 
-                 (QList<QWidget *> ()
-                  <<ui.splitTimeSpin
-                  <<ui.splitTimeCombo));
-  addCheckEnabler(ui.splitDistanceCheck, 
-                 (QList<QWidget *> ()
-                  <<ui.splitDistSpin
-                  <<ui.splitDistCombo));
+  addCheckEnabler(ui.splitTimeCheck,
+                  (QList<QWidget*> ()
+                   <<ui.splitTimeSpin
+                   <<ui.splitTimeCombo));
+  addCheckEnabler(ui.splitDistanceCheck,
+                  (QList<QWidget*> ()
+                   <<ui.splitDistSpin
+                   <<ui.splitDistCombo));
 
-  connect(ui.mergeCheck, SIGNAL(clicked()) , this, SLOT(mergeCheckX()));
+  connect(ui.mergeCheck, SIGNAL(clicked()), this, SLOT(mergeCheckX()));
   connect(ui.packCheck,  SIGNAL(clicked()),  this, SLOT(packCheckX()));
   connect(ui.startCheck, SIGNAL(clicked()),  this, SLOT(otherCheckX()));
   connect(ui.stopCheck,   SIGNAL(clicked()), this, SLOT(otherCheckX()));
@@ -103,7 +103,7 @@ void TrackWidget::otherCheckX()
   ui.splitTimeCombo->setEnabled(ui.splitTimeCheck->isChecked());
   ui.splitDistSpin->setEnabled(ui.splitDistanceCheck->isChecked());
   ui.splitDistCombo->setEnabled(ui.splitDistanceCheck->isChecked());
-  
+
   bool bb = (ui.mergeCheck->isChecked() || ui.packCheck->isChecked());
   ui.splitDateCheck->setEnabled(bb);
   ui.splitTimeCheck->setEnabled(bb);
@@ -113,15 +113,17 @@ void TrackWidget::otherCheckX()
 //------------------------------------------------------------------------
 void TrackWidget::mergeCheckX()
 {
-  if (ui.mergeCheck->isChecked())
+  if (ui.mergeCheck->isChecked()) {
     ui.packCheck->setChecked(false);
+  }
   otherCheckX();
 }
 //------------------------------------------------------------------------
 void TrackWidget::packCheckX()
 {
-  if (ui.packCheck->isChecked())
+  if (ui.packCheck->isChecked()) {
     ui.mergeCheck->setChecked(false);
+  }
   otherCheckX();
 }
 
@@ -156,16 +158,16 @@ void TrackWidget::splitDistanceX()
 
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
-WayPtsWidget::WayPtsWidget(QWidget *parent, WayPtsFilterData &wfd): FilterWidget(parent) , wfd(wfd)
+WayPtsWidget::WayPtsWidget(QWidget* parent, WayPtsFilterData& wfd): FilterWidget(parent), wfd(wfd)
 {
   ui.setupUi(this);
   addCheckEnabler(ui.duplicatesCheck,
-                 QList<QWidget*>() << ui.shortNamesCheck << ui.locationsCheck);
-  addCheckEnabler(ui.positionCheck, 
-                 QList<QWidget*>() << ui.positionText << ui.positionUnitCombo);
+                  QList<QWidget*>() << ui.shortNamesCheck << ui.locationsCheck);
+  addCheckEnabler(ui.positionCheck,
+                  QList<QWidget*>() << ui.positionText << ui.positionUnitCombo);
   addCheckEnabler(ui.radiusCheck,
-                 QList<QWidget*>() << ui.latLabel << ui.latText << ui.longLabel <<
-                 ui.longText << ui.radiusUnitCombo << ui.radiusText);
+                  QList<QWidget*>() << ui.latLabel << ui.latText << ui.longLabel <<
+                  ui.longText << ui.radiusUnitCombo << ui.radiusText);
 
   fopts << new BoolFilterOption(wfd.duplicates, ui.duplicatesCheck);
   fopts << new BoolFilterOption(wfd.shortNames, ui.shortNamesCheck);
@@ -188,23 +190,25 @@ WayPtsWidget::WayPtsWidget(QWidget *parent, WayPtsFilterData &wfd): FilterWidget
 //------------------------------------------------------------------------
 void WayPtsWidget::shortNamesCkX()
 {
-  if (!ui.shortNamesCheck->isChecked())
+  if (!ui.shortNamesCheck->isChecked()) {
     ui.locationsCheck->setChecked(true);
+  }
 }
 //------------------------------------------------------------------------
 void WayPtsWidget::locationsCkX()
 {
-  if (!ui.locationsCheck->isChecked())
+  if (!ui.locationsCheck->isChecked()) {
     ui.shortNamesCheck->setChecked(true);
+  }
 }
 
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
-RtTrkWidget::RtTrkWidget(QWidget *parent, RtTrkFilterData &rfd): FilterWidget(parent) , rfd(rfd)
+RtTrkWidget::RtTrkWidget(QWidget* parent, RtTrkFilterData& rfd): FilterWidget(parent), rfd(rfd)
 {
   ui.setupUi(this);
   addCheckEnabler(ui.simplifyCheck,
-                 QList<QWidget*>() << ui.limitToLabel << ui.limitToSpin << ui.pointLabel);
+                  QList<QWidget*>() << ui.limitToLabel << ui.limitToSpin << ui.pointLabel);
 
   fopts << new BoolFilterOption(rfd.simplify_, ui.simplifyCheck);
   fopts << new BoolFilterOption(rfd.reverse_, ui.reverseCheck);
@@ -215,7 +219,7 @@ RtTrkWidget::RtTrkWidget(QWidget *parent, RtTrkFilterData &rfd): FilterWidget(pa
 
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
-MiscFltWidget::MiscFltWidget(QWidget *parent, MiscFltFilterData &mfd): FilterWidget(parent) , mfd(mfd)
+MiscFltWidget::MiscFltWidget(QWidget* parent, MiscFltFilterData& mfd): FilterWidget(parent), mfd(mfd)
 {
   ui.setupUi(this);
   ui.transformCombo->addItem(QString("%1 %2 %3").arg(tr("Tracks")).arg(QChar(8594)).arg(tr("Waypoints")));
@@ -225,7 +229,7 @@ MiscFltWidget::MiscFltWidget(QWidget *parent, MiscFltFilterData &mfd): FilterWid
   ui.transformCombo->addItem(QString("%1 %2 %3").arg(tr("Tracks")).arg(QChar(8594)).arg(tr("Routes")));
   ui.transformCombo->addItem(QString("%1 %2 %3").arg(tr("Waypoints")).arg(QChar(8594)).arg(tr("Tracks")));
   addCheckEnabler(ui.transformCheck,
-                 QList<QWidget*>() << ui.transformCombo << ui.deleteCheck);
+                  QList<QWidget*>() << ui.transformCombo << ui.deleteCheck);
 
   fopts << new BoolFilterOption(mfd.transform_, ui.transformCheck);
   fopts << new BoolFilterOption(mfd.swap_, ui.swapCheck);
index fb2a2cc50a15dae9528bd44c916239b7cbfe0b17..bf225d6a51a52cadccc47b3ffcbbc72f1fe8d82e 100644 (file)
@@ -36,15 +36,15 @@ class FilterOption;
 class CheckEnabler: public QObject
 {
   Q_OBJECT
-    public:
-  CheckEnabler(QObject *parent, QAbstractButton *ck, QWidget *w): QObject(parent), checkBox(ck)
+public:
+  CheckEnabler(QObject* parent, QAbstractButton* ck, QWidget* w): QObject(parent), checkBox(ck)
   {
     widgetList << w;
     connect(ck, SIGNAL(clicked()), this, SLOT(checkStatusChanged()));
     checkStatusChanged();
     fixWhatsThis();
   }
-  CheckEnabler(QObject *parent, QAbstractButton *ck, QList<QWidget *> &wl): 
+  CheckEnabler(QObject* parent, QAbstractButton* ck, QList<QWidget*>& wl):
     QObject(parent), checkBox(ck)
   {
     widgetList = wl;
@@ -61,26 +61,28 @@ public slots:
       widgetList[i]->setEnabled(b);
     }
   }
-  
+
 private:
-  QAbstractButton *checkBox;
+  QAbstractButtoncheckBox;
   QList<QWidget*> widgetList;
   void fixWhatsThis()
   {
     QString wts = checkBox->whatsThis();
     if (wts.length() != 0) {
       for (int i=0; i<widgetList.size(); i++) {
-       QString s = widgetList[i]->whatsThis();
-       if (s.length() == 0)
-         widgetList[i]->setWhatsThis(wts);
+        QString s = widgetList[i]->whatsThis();
+        if (s.length() == 0) {
+          widgetList[i]->setWhatsThis(wts);
+        }
       }
     }
     QString wtf = checkBox->toolTip();
     if (wtf.length() != 0) {
       for (int i=0; i<widgetList.size(); i++) {
-       QString s = widgetList[i]->toolTip();
-       if (s.length() == 0)
-         widgetList[i]->setToolTip(wtf);
+        QString s = widgetList[i]->toolTip();
+        if (s.length() == 0) {
+          widgetList[i]->setToolTip(wtf);
+        }
       }
     }
   }
@@ -90,7 +92,7 @@ private:
 //------------------------------------------------------------------------
 class FilterOption
 {
- public:
+public:
   FilterOption() {};
   virtual ~FilterOption() {};
   virtual void setWidgetValue() = 0;
@@ -100,75 +102,95 @@ class FilterOption
 //------------------------------------------------------------------------
 class BoolFilterOption: public FilterOption
 {
- public:
BoolFilterOption(bool &b, QAbstractButton *ck): FilterOption(), b(b), checkBox(ck)
+public:
 BoolFilterOption(bool& b, QAbstractButton* ck): FilterOption(), b(b), checkBox(ck)
   {
   }
-  void setWidgetValue() {checkBox->setChecked(b); }
-  void getWidgetValue() {b = checkBox->isChecked();  }
-    
- private:
-  bool &b;
-  QAbstractButton *checkBox;
+  void setWidgetValue()
+  {
+    checkBox->setChecked(b);
+  }
+  void getWidgetValue()
+  {
+    b = checkBox->isChecked();
+  }
+
+private:
+  bool& b;
+  QAbstractButton* checkBox;
 };
 
 //------------------------------------------------------------------------
 class IntSpinFilterOption: public FilterOption
 {
- public:
-  IntSpinFilterOption(int &val, QSpinBox *sb, int bottom = -100, int top = 100): FilterOption(), val(val), spinBox(sb)
+public:
+  IntSpinFilterOption(int& val, QSpinBox* sb, int bottom = -100, int top = 100): FilterOption(), val(val), spinBox(sb)
   {
     sb->setRange(bottom, top);
   }
-  void setWidgetValue() {spinBox->setValue(val); }
-  void getWidgetValue() {val = spinBox->value();  }
-    
- private:
-  int &val;
-  QSpinBox *spinBox;
+  void setWidgetValue()
+  {
+    spinBox->setValue(val);
+  }
+  void getWidgetValue()
+  {
+    val = spinBox->value();
+  }
+
+private:
+  int& val;
+  QSpinBox* spinBox;
 };
 
 //------------------------------------------------------------------------
 class StringFilterOption: public FilterOption
 {
- public:
- StringFilterOption(QString &val, QLineEdit *le): FilterOption(), val(val), lineEdit(le)
+public:
+  StringFilterOption(QString& val, QLineEdit* le): FilterOption(), val(val), lineEdit(le)
+  {
+  }
+  void setWidgetValue()
+  {
+    lineEdit->setText(val);
+  }
+  void getWidgetValue()
   {
+    val = lineEdit->text();
   }
-  void setWidgetValue() {lineEdit->setText(val); }
-  void getWidgetValue() {val = lineEdit->text();  }
-    
- private:
-  QString &val;
-  QLineEdit *lineEdit;
+
+private:
+  QString& val;
+  QLineEdit* lineEdit;
 };
 
 //------------------------------------------------------------------------
 class DoubleFilterOption: public FilterOption
 {
- public:
-  DoubleFilterOption(double &val, QLineEdit *le,
-                    double minVal = -1.E308, 
-                    double maxVal = 1.0E308,
-                    int decimals = -1, 
-                    char format = 'g'
-                    ): FilterOption(), val(val), lineEdit(le), minVal(minVal),
-                       maxVal(maxVal), decimals(decimals), format(format)
+public:
+  DoubleFilterOption(double& val, QLineEdit* le,
+                     double minVal = -1.E308,
+                     double maxVal = 1.0E308,
+                     int decimals = -1,
+                     char format = 'g'
+                    ): FilterOption(), val(val), lineEdit(le), minVal(minVal),
+    maxVal(maxVal), decimals(decimals), format(format)
   {
     le->setValidator(new QDoubleValidator(minVal, maxVal, decimals, le));
   }
-  void setWidgetValue() {
+  void setWidgetValue()
+  {
     lineEdit->setText(QString("%1").arg(val, 0, format, decimals));
   }
-  void getWidgetValue() {
-    val = lineEdit->text().toDouble(); 
+  void getWidgetValue()
+  {
+    val = lineEdit->text().toDouble();
     val = qMin(val, maxVal);
     val = qMax(val, minVal);
   }
-    
- private:
-  double &val;
-  QLineEdit *lineEdit;
+
+private:
+  doubleval;
+  QLineEditlineEdit;
   double minVal, maxVal;
   int decimals;
   char format;
@@ -177,31 +199,43 @@ class DoubleFilterOption: public FilterOption
 //------------------------------------------------------------------------
 class DateTimeFilterOption: public FilterOption
 {
- public:
- DateTimeFilterOption(QDateTime &val, QDateTimeEdit *w): FilterOption(), val(val), w(w)
+public:
+  DateTimeFilterOption(QDateTime& val, QDateTimeEdit* w): FilterOption(), val(val), w(w)
+  {
+  }
+  void setWidgetValue()
+  {
+    w->setDateTime(val);
+  }
+  void getWidgetValue()
   {
+    val = w->dateTime();
   }
-  void setWidgetValue() {w->setDateTime(val); }
-  void getWidgetValue() {val = w->dateTime();  }
-    
- private:
-  QDateTime &val;
-  QDateTimeEdit *w;
+
+private:
+  QDateTime& val;
+  QDateTimeEdit* w;
 };
 
 //------------------------------------------------------------------------
 class ComboFilterOption: public FilterOption
 {
- public:
- ComboFilterOption(int &val, QComboBox *w): FilterOption(), val(val), w(w)
+public:
+  ComboFilterOption(int& val, QComboBox* w): FilterOption(), val(val), w(w)
+  {
+  }
+  void setWidgetValue()
   {
+    w->setCurrentIndex(val);
   }
-  void setWidgetValue() {w->setCurrentIndex(val); }
-  void getWidgetValue() {val = w->currentIndex();  }
-    
- private:
-  int &val;
-  QComboBox *w;
+  void getWidgetValue()
+  {
+    val = w->currentIndex();
+  }
+
+private:
+  int& val;
+  QComboBox* w;
 };
 
 
@@ -209,56 +243,65 @@ class ComboFilterOption: public FilterOption
 class FilterWidget: public QWidget
 {
 public:
-  FilterWidget(QWidget *parent) : QWidget(parent) {}
-  ~FilterWidget() {
-    for (int i=0; i<fopts.size(); i++)
+  FilterWidget(QWidget* parent) : QWidget(parent) {}
+  ~FilterWidget()
+  {
+    for (int i=0; i<fopts.size(); i++) {
       delete fopts[i];
+    }
   }
 
-  void getWidgetValues() {
+  void getWidgetValues()
+  {
     for (int i=0; i<fopts.size(); i++) {
       fopts[i]->getWidgetValue();
     }
   }
-  void setWidgetValues() {
-    for (int i=0; i<fopts.size(); i++)
+  void setWidgetValues()
+  {
+    for (int i=0; i<fopts.size(); i++) {
       fopts[i]->setWidgetValue();
+    }
   }
-  void addCheckEnabler(QAbstractButton *ck, QWidget *w) {
+  void addCheckEnabler(QAbstractButton* ck, QWidget* w)
+  {
     enbls << new CheckEnabler(this, ck, w);
   }
-  void addCheckEnabler(QAbstractButton *ck, QList<QWidget *> &wl)
+  void addCheckEnabler(QAbstractButton* ck, QList<QWidget*>& wl)
   {
     enbls << new CheckEnabler(this, ck, wl);
   }
-  virtual void checkChecks(){
-    for (int i=0; i<enbls.size(); i++)
+  virtual void checkChecks()
+  {
+    for (int i=0; i<enbls.size(); i++) {
       enbls[i]->checkStatusChanged();
+    }
   }
 
 protected:
   QList <FilterOption*> fopts;
-  QList <CheckEnabler *> enbls;
+  QList <CheckEnabler*> enbls;
 };
 
 //------------------------------------------------------------------------
 
 class TrackWidget: public FilterWidget
 {
-Q_OBJECT
- public:
-  TrackWidget(QWidget *parent, TrackFilterData &tf);
+  Q_OBJECT
+public:
+  TrackWidget(QWidget* parent, TrackFilterData& tf);
 
-  virtual void checkChecks(){
+  virtual void checkChecks()
+  {
     otherCheckX();
     FilterWidget::checkChecks();
   }
 
- private:
+private:
   Ui_TrackWidget ui;
-  TrackFilterData &tfd;
+  TrackFilterDatatfd;
 
-  private slots:
+private slots:
   void mergeCheckX();
   void otherCheckX();
   void splitDateX();
@@ -270,14 +313,14 @@ Q_OBJECT
 //------------------------------------------------------------------------
 class WayPtsWidget: public FilterWidget
 {
-Q_OBJECT
- public:
-  WayPtsWidget(QWidget *parent, WayPtsFilterData &wf);
+  Q_OBJECT
+public:
+  WayPtsWidget(QWidget* parent, WayPtsFilterData& wf);
 
- private:
+private:
   Ui_WayPtsWidget ui;
-  WayPtsFilterData &wfd;
-  
+  WayPtsFilterDatawfd;
+
 private slots:
   void locationsCkX();
   void shortNamesCkX();
@@ -286,24 +329,24 @@ private slots:
 //------------------------------------------------------------------------
 class RtTrkWidget: public FilterWidget
 {
-Q_OBJECT
- public:
-  RtTrkWidget(QWidget *parent, RtTrkFilterData &wf);
+  Q_OBJECT
+public:
+  RtTrkWidget(QWidget* parent, RtTrkFilterData& wf);
 
- private:
+private:
   Ui_RtTrkWidget ui;
-  RtTrkFilterData &rfd;
+  RtTrkFilterDatarfd;
 };
 //------------------------------------------------------------------------
 class MiscFltWidget: public FilterWidget
 {
-Q_OBJECT
- public:
-  MiscFltWidget(QWidget *, MiscFltFilterData &);
+  Q_OBJECT
+public:
+  MiscFltWidget(QWidget*, MiscFltFilterData&);
 
- private:
+private:
   Ui_MiscFltWidget ui;
-  MiscFltFilterData &mfd;
+  MiscFltFilterDatamfd;
 };
 
 #endif
index 7190cdb7befee5e498a47c3454f2e2ea5275e6d4..6607bd4affdc0fb21766626b5cd70cf3ab86750d 100644 (file)
@@ -25,7 +25,8 @@
 
 QString Format::htmlBase_ = QString();
 
-static void saveOptions(QSettings &settings, const QString &prefix, const QList<FormatOption> &options) {
+static void saveOptions(QSettings& settings, const QString& prefix, const QList<FormatOption>& options)
+{
   for (int i=0; i<options.size(); i++) {
     QString kp = prefix + "." + options[i].getName();
     QString k1 = kp + ".selected";
@@ -35,7 +36,8 @@ static void saveOptions(QSettings &settings, const QString &prefix, const QList<
   }
 }
 
-static void restoreOptions(QSettings &settings, const QString&prefix, QList<FormatOption> &options) {
+static void restoreOptions(QSettings& settings, const QString& prefix, QList<FormatOption>& options)
+{
   for (int i=0; i<options.size(); i++) {
     QString kp = prefix + "." + options[i].getName();
     QString k1 = kp + ".selected";
@@ -47,7 +49,7 @@ static void restoreOptions(QSettings &settings, const QString&prefix, QList<Form
   }
 }
 
-void Format::saveSettings(QSettings &settings)
+void Format::saveSettings(QSettingssettings)
 {
   saveOptions(settings, name_+".input", inputOptions_);
   saveOptions(settings, name_+".output", outputOptions_);
@@ -56,7 +58,7 @@ void Format::saveSettings(QSettings &settings)
   settings.setValue(name_+".hidden", isHidden());
 }
 
-void Format::restoreSettings(QSettings &settings)
+void Format::restoreSettings(QSettingssettings)
 {
   restoreOptions(settings, name_ + ".input", inputOptions_);
   restoreOptions(settings, name_ + ".output", outputOptions_);
index 4e10c03a1eb50f93ed8e1beab1151db23a42077e..a92f11bbf9e6993c9ae8a59df90170fe98e07bc1 100644 (file)
@@ -40,25 +40,25 @@ public:
     OPTinFile,
     OPToutFile,
   } optionType;
-  
+
   FormatOption(): name_(QString()), description_(QString()), type_(OPTbool),
-      defaultValue_(QVariant()),
-      minValue_(QVariant()), maxValue_(QVariant()),
-      html_(QString()), value_(QVariant()), isSelected_(false)
+    defaultValue_(QVariant()),
+    minValue_(QVariant()), maxValue_(QVariant()),
+    html_(QString()), value_(QVariant()), isSelected_(false)
   {
   }
-  FormatOption(const QString &name, 
-              const QString &description,
-              optionType type,
-              QVariant defaultValue = QVariant(),
-              QVariant minValue = QVariant(),
-              QVariant maxValue = QVariant(),
-              QString html = QString()
-         ): name_(name), description_(description), type_(type),
-      defaultValue_(defaultValue), minValue_(minValue), maxValue_(maxValue), html_(html)
+  FormatOption(const QString& name,
+               const QString& description,
+               optionType type,
+               QVariant defaultValue = QVariant(),
+               QVariant minValue = QVariant(),
+               QVariant maxValue = QVariant(),
+               QString html = QString()
+              ): name_(name), description_(description), type_(type),
+    defaultValue_(defaultValue), minValue_(minValue), maxValue_(maxValue), html_(html)
   {
     value_ = QVariant();
-    // Boolean values pay more atention to 'selected' than value.  Make 
+    // Boolean values pay more atention to 'selected' than value.  Make
     // them match here. For non-bools, just make them unchecked.
     if (type_ == OPTbool && defaultValue.toBool() == true) {
       isSelected_ = true;
@@ -67,25 +67,58 @@ public:
     }
   }
 
-  FormatOption(const FormatOption & c)
+  FormatOption(const FormatOption& c)
     : name_(c.name_), description_(c.description_), type_(c.type_),
       defaultValue_(c.defaultValue_), minValue_(c.minValue_), maxValue_(c.maxValue_), html_(c.html_),
       value_(c.value_), isSelected_(c.isSelected_)
   {
   }
-  
-  QString  getName() const {return name_; }
-  QString  getDescription() const {return description_; }
-  optionType getType() const {return type_; }
-  QVariant getValue() const    { return value_; }
-  bool     getSelected() const {return isSelected_; }
-  QVariant getMinValue() const {return minValue_; }
-  QVariant getMaxValue() const {return maxValue_; }
-  QVariant getDefaultValue() const {return defaultValue_; }
 
-  void setValue(QVariant v) { value_ = v; };
-  void setSelected(bool v)  { isSelected_ = v; };
-  QString getHtml() const { return html_; };
+  QString  getName() const
+  {
+    return name_;
+  }
+  QString  getDescription() const
+  {
+    return description_;
+  }
+  optionType getType() const
+  {
+    return type_;
+  }
+  QVariant getValue() const
+  {
+    return value_;
+  }
+  bool     getSelected() const
+  {
+    return isSelected_;
+  }
+  QVariant getMinValue() const
+  {
+    return minValue_;
+  }
+  QVariant getMaxValue() const
+  {
+    return maxValue_;
+  }
+  QVariant getDefaultValue() const
+  {
+    return defaultValue_;
+  }
+
+  void setValue(QVariant v)
+  {
+    value_ = v;
+  };
+  void setSelected(bool v)
+  {
+    isSelected_ = v;
+  };
+  QString getHtml() const
+  {
+    return html_;
+  };
 
 private:
   QString name_;
@@ -101,38 +134,38 @@ private:
 
 
 //------------------------------------------------------------------------
-class Format 
+class Format
 {
- public:
+public:
   Format():name_(QString()),
-     description_(QString()),
-     readWaypoints_(false),
-     readTracks_(false),
-     readRoutes_(false),
-     writeWaypoints_(false),
-     writeTracks_(false),
-     writeRoutes_(false),
-     fileFormat_(false),
-     deviceFormat_(false),
-           hidden_(false),
-     extensions_(QStringList()),
-           html_(QString()),
-           readUseCount_(0),
-           writeUseCount_(0)
+    description_(QString()),
+    readWaypoints_(false),
+    readTracks_(false),
+    readRoutes_(false),
+    writeWaypoints_(false),
+    writeTracks_(false),
+    writeRoutes_(false),
+    fileFormat_(false),
+    deviceFormat_(false),
+    hidden_(false),
+    extensions_(QStringList()),
+    html_(QString()),
+    readUseCount_(0),
+    writeUseCount_(0)
   {
     inputOptions_.clear();
     outputOptions_.clear();
   };
 
-  Format(const QString &name,
-        const QString &description,
-        bool readWaypoints, bool readTracks, bool readRoutes,
-        bool writeWaypoints, bool writeTracks, bool writeRoutes,
-        bool fileFormat, bool deviceFormat,
-        const QStringList &extensions,
-        QList<FormatOption> &inputOptions, 
-        QList<FormatOption> &outputptions,
-         const QString &html):
+  Format(const QStringname,
+         const QString& description,
+         bool readWaypoints, bool readTracks, bool readRoutes,
+         bool writeWaypoints, bool writeTracks, bool writeRoutes,
+         bool fileFormat, bool deviceFormat,
+         const QStringList& extensions,
+         QList<FormatOption>& inputOptions,
+         QList<FormatOption>& outputptions,
+         const QStringhtml):
     name_(name), description_(description),
     readWaypoints_(readWaypoints), readTracks_(readTracks), readRoutes_(readRoutes),
     writeWaypoints_(writeWaypoints), writeTracks_(writeTracks), writeRoutes_(writeRoutes),
@@ -148,7 +181,7 @@ class Format
     (void)html; // suppress 'unused' warning.
   }
 
-  Format(const Format &c):
+  Format(const Formatc):
     name_(c.name_), description_(c.description_),
     readWaypoints_(c.readWaypoints_), readTracks_(c.readTracks_), readRoutes_(c.readRoutes_),
     writeWaypoints_(c.writeWaypoints_), writeTracks_(c.writeTracks_), writeRoutes_(c.writeRoutes_),
@@ -165,52 +198,127 @@ class Format
 
   ~Format() {};
 
-  bool isReadWaypoints() const { return readWaypoints_; };
-  bool isReadTracks() const    { return readTracks_; };
-  bool isReadRoutes() const    { return readRoutes_; };
-  bool isReadSomething() const { 
-    return isReadWaypoints() || isReadTracks () || isReadRoutes(); 
+  bool isReadWaypoints() const
+  {
+    return readWaypoints_;
+  };
+  bool isReadTracks() const
+  {
+    return readTracks_;
+  };
+  bool isReadRoutes() const
+  {
+    return readRoutes_;
+  };
+  bool isReadSomething() const
+  {
+    return isReadWaypoints() || isReadTracks() || isReadRoutes();
   };
 
-  bool isWriteWaypoints() const { return writeWaypoints_; };
-  bool isWriteTracks() const    { return writeTracks_; };
-  bool isWriteRoutes() const    { return writeRoutes_; };
-  bool isWriteSomething() const { 
-    return isWriteWaypoints() || isWriteTracks () || isWriteRoutes(); 
+  bool isWriteWaypoints() const
+  {
+    return writeWaypoints_;
+  };
+  bool isWriteTracks() const
+  {
+    return writeTracks_;
+  };
+  bool isWriteRoutes() const
+  {
+    return writeRoutes_;
+  };
+  bool isWriteSomething() const
+  {
+    return isWriteWaypoints() || isWriteTracks() || isWriteRoutes();
   };
 
-  QString getName() const           { return name_; };
-  QString getDescription() const    { return description_; };
-  QString getHtml() const           { return html_; };
-  QStringList getExtensions() const { return extensions_; };
-  const QList<FormatOption> &getInputOptions()  const { return inputOptions_; };
-  const QList<FormatOption> &getOutputOptions() const { return outputOptions_; };
+  QString getName() const
+  {
+    return name_;
+  };
+  QString getDescription() const
+  {
+    return description_;
+  };
+  QString getHtml() const
+  {
+    return html_;
+  };
+  QStringList getExtensions() const
+  {
+    return extensions_;
+  };
+  const QList<FormatOption>& getInputOptions()  const
+  {
+    return inputOptions_;
+  };
+  const QList<FormatOption>& getOutputOptions() const
+  {
+    return outputOptions_;
+  };
+
+  QList<FormatOption>* getInputOptionsRef()
+  {
+    return &inputOptions_;
+  };
+  QList<FormatOption>* getOutputOptionsRef()
+  {
+    return &outputOptions_;
+  };
 
-  QList<FormatOption> *getInputOptionsRef()  { return &inputOptions_; };
-  QList<FormatOption> *getOutputOptionsRef() { return &outputOptions_; };
+  bool isDeviceFormat() const
+  {
+    return deviceFormat_;
+  };
+  bool isFileFormat() const
+  {
+    return   fileFormat_;
+  };
 
-  bool isDeviceFormat() const { return deviceFormat_; };
-  bool isFileFormat() const { return   fileFormat_; };
+  bool isHidden() const
+  {
+    return hidden_;
+  };
+  void setHidden(bool state)
+  {
+    hidden_ = state;
+  };
 
-  bool isHidden() const { return hidden_; };
-  void setHidden(bool state) { hidden_ = state; };
-  
-  void saveSettings(QSettings &settings);
-  void restoreSettings(QSettings &settings);
+  void saveSettings(QSettings& settings);
+  void restoreSettings(QSettings& settings);
   void setToDefault();
-  static QString getHtmlBase() { return htmlBase_; }
-  static void setHtmlBase(const QString &s) { htmlBase_ = s; }
-  
-  void bumpReadUseCount(int v)  { readUseCount_ += v; }
-  void bumpWriteUseCount(int v) { writeUseCount_ += v; }
-  int getReadUseCount()  const { return readUseCount_; }
-  int getWriteUseCount() const { return writeUseCount_; }
-  void zeroUseCounts() {
+  static QString getHtmlBase()
+  {
+    return htmlBase_;
+  }
+  static void setHtmlBase(const QString& s)
+  {
+    htmlBase_ = s;
+  }
+
+  void bumpReadUseCount(int v)
+  {
+    readUseCount_ += v;
+  }
+  void bumpWriteUseCount(int v)
+  {
+    writeUseCount_ += v;
+  }
+  int getReadUseCount()  const
+  {
+    return readUseCount_;
+  }
+  int getWriteUseCount() const
+  {
+    return writeUseCount_;
+  }
+  void zeroUseCounts()
+  {
     readUseCount_  = 0;
     writeUseCount_ = 0;
   }
-  
- private:
+
+private:
   QString name_, description_;
   bool readWaypoints_, readTracks_, readRoutes_;
   bool writeWaypoints_, writeTracks_, writeRoutes_;
@@ -222,7 +330,7 @@ class Format
   static QString htmlBase_;
   int      readUseCount_;
   int      writeUseCount_;
-  
+
 };
 
 #endif
index 774e3b7c12d02f8534eaeab3858ae4e152e02dae..79b7e2636498b6e49fefdb17aade13cd8b4a1825 100644 (file)
@@ -30,7 +30,8 @@
 #include "appname.h"
 
 //------------------------------------------------------------------------
-static QString xlt(const QString &f) {
+static QString xlt(const QString& f)
+{
   return QCoreApplication::translate("", f.toStdString().c_str());
 }
 
@@ -38,13 +39,14 @@ static QString xlt(const QString &f) {
 bool FormatLoad::skipToValidLine()
 {
   QRegExp regex("^(file|serial)");
-  while (currentLine_ <lines_.size() && regex.indexIn(lines_[currentLine_]) != 0)
+  while (currentLine_ <lines_.size() && regex.indexIn(lines_[currentLine_]) != 0) {
     currentLine_++;
+  }
   return (currentLine_<lines_.size());
 }
 
 //------------------------------------------------------------------------
-bool FormatLoad::processFormat(Format &format)
+bool FormatLoad::processFormat(Formatformat)
 {
   QStringList hfields = lines_[currentLine_++].split("\t");
   if (hfields.size() < 5) {
@@ -69,48 +71,48 @@ bool FormatLoad::processFormat(Format &format)
     QString optionMax   = ofields[7];
     QString optionHtml  = ofields[8];
     FormatOption::optionType type = FormatOption::OPTbool;
-    if (optionType == "boolean")
+    if (optionType == "boolean") {
       type = FormatOption::OPTbool;
-    else if (optionType == "string")
+    } else if (optionType == "string") {
       type = FormatOption::OPTstring;
-    else if (optionType == "integer") {
+    else if (optionType == "integer") {
       type = (optionMax != "" && optionMin != "") ? FormatOption::OPTboundedInt : FormatOption::OPTint;
-      if (optionMax == "")
-       optionMax = "2147483647";
-      if (optionMin == "")
-       optionMin = "-2147483647";
-    }
-    else if (optionType == "float") {
+      if (optionMax == "") {
+        optionMax = "2147483647";
+      }
+      if (optionMin == "") {
+        optionMin = "-2147483647";
+      }
+    } else if (optionType == "float") {
       type = FormatOption::OPTfloat;
-      if (optionMax == "")
-       optionMax = "1.0E308";
-      if (optionMin == "")
-       optionMin = "-1.0E308";
-    }
-    else if (optionType == "file") {
+      if (optionMax == "") {
+        optionMax = "1.0E308";
+      }
+      if (optionMin == "") {
+        optionMin = "-1.0E308";
+      }
+    } else if (optionType == "file") {
       type = FormatOption::OPTinFile;
-    }
-    else if (optionType == "outfile") {
+    } else if (optionType == "outfile") {
       type = FormatOption::OPToutFile;
-    }
-    else {
+    } else {
       type = FormatOption::OPTstring;
     }
     optionList << FormatOption(name, xlt(description),
-                              type, QVariant(optionDef), QVariant(optionMin),
-                              QVariant(optionMax), optionHtml);
+                               type, QVariant(optionDef), QVariant(optionMin),
+                               QVariant(optionMax), optionHtml);
     currentLine_++;
   }
   QList <FormatOption> optionList2 = optionList;
 
   format = Format(hfields[2], xlt(hfields[4]),
-                 hfields[1][0] == QChar('r'),  hfields[1][2] == QChar('r'),  hfields[1][4] == QChar('r'),
-                 hfields[1][1] == QChar('w'),  hfields[1][3] == QChar('w'),  hfields[1][5] == QChar('w'),
-                 hfields[0] == "file",
-                 hfields[0] == "serial",
-                 hfields[3].split('/'),
-                 optionList,
-                 optionList2, htmlPage);
+                  hfields[1][0] == QChar('r'),  hfields[1][2] == QChar('r'),  hfields[1][4] == QChar('r'),
+                  hfields[1][1] == QChar('w'),  hfields[1][3] == QChar('w'),  hfields[1][5] == QChar('w'),
+                  hfields[0] == "file",
+                  hfields[0] == "serial",
+                  hfields[3].split('/'),
+                  optionList,
+                  optionList2, htmlPage);
   if (htmlPage.length() > 0 && Format::getHtmlBase().length() == 0) {
     QString base = htmlPage;
     base.replace(QRegExp("/[^/]+$"), "/");
@@ -120,24 +122,27 @@ bool FormatLoad::processFormat(Format &format)
 }
 
 //------------------------------------------------------------------------
-bool FormatLoad::getFormats(QList<Format> &formatList)
+bool FormatLoad::getFormats(QList<Format>formatList)
 {
   formatList.clear();
 
   QProcess babel;
   babel.start("gpsbabel", QStringList() << "-^3");
-  if (!babel.waitForStarted())
+  if (!babel.waitForStarted()) {
     return false;
+  }
   babel.closeWriteChannel();
-  if (!babel.waitForFinished())
+  if (!babel.waitForFinished()) {
     return false;
-  if (babel.exitCode() != 0)
+  }
+  if (babel.exitCode() != 0) {
     return false;
+  }
 
   QTextStream tstream(babel.readAll());
   QList<int>lineList;
   int k=0;
-  while(!tstream.atEnd()) {
+  while (!tstream.atEnd()) {
     QString l = tstream.readLine();
     k++;
     if (!QRegExp("^[\\s]*$").exactMatch(l)) {
@@ -147,14 +152,13 @@ bool FormatLoad::getFormats(QList<Format> &formatList)
   }
   currentLine_ = 0;
 
-  for  (bool dataPresent = skipToValidLine(); dataPresent; dataPresent=skipToValidLine()) {
+  for (bool dataPresent = skipToValidLine(); dataPresent; dataPresent=skipToValidLine()) {
     Format format;
     if (!processFormat(format)) {
       QMessageBox::information
-       (0, appName,
-   QObject::tr("Error processing formats from running process \"gpsbabel -^3\" at line %1").arg(lineList[currentLine_]));
-    }
-    else {
+      (0, appName,
+       QObject::tr("Error processing formats from running process \"gpsbabel -^3\" at line %1").arg(lineList[currentLine_]));
+    } else {
       formatList << format;
     }
   }
index 0fd0fe1a5a7537c747b49195e3d39657c55fae2b..2389d24447363bd94e6e1ae82607deaf8040f6a9 100644 (file)
 
 #include "format.h"
 
-class FormatLoad {
- public:
+class FormatLoad
+{
+public:
   FormatLoad() : currentLine_(0) {};
   ~FormatLoad() {};
-  
-  bool getFormats(QList<Format> &formatList);
- private:
+
+  bool getFormats(QList<Format>formatList);
+private:
   QStringList lines_;
   int currentLine_;
   bool skipToValidLine();
-  bool processFormat(Format &format);
+  bool processFormat(Formatformat);
 };
 
 #endif
index cb2bfcfe4692af62e48dcc30ae877460df762d0a..aec2fec66a190e3de4861ad206cd3d3382d1df4b 100644 (file)
 //------------------------------------------------------------------------
 class StandardItem: public QStandardItem
 {
- public:
-  StandardItem(const QString &text): QStandardItem(text)
-    {
-      this->setEditable(false);
-    }
+public:
+  StandardItem(const QStringtext): QStandardItem(text)
+  {
+    this->setEditable(false);
+  }
 };
 
 //------------------------------------------------------------------------
 class TreeAction: public QAction
 {
 public:
-  TreeAction(const QString &text,
-            QObject *obj, const char *member,  QObject *parent): QAction(text, parent)
+  TreeAction(const QStringtext,
+             QObject* obj, const char* member,  QObject* parent): QAction(text, parent)
   {
     connect(this, SIGNAL(triggered()), obj, member);
   }
@@ -69,56 +69,61 @@ QString GMapDialog::formatLength(double l)
     fpsPrecision = 3;
   }
   return QString(tr("Length: %1 %2\n  %3 %4")
-                .arg(metricLength, 0, 'f', metricPrecision)
-                .arg(metricUnit)
-                .arg(fpsLength, 0, 'f', fpsPrecision)
-                .arg(fpsUnit));
+                 .arg(metricLength, 0, 'f', metricPrecision)
+                 .arg(metricUnit)
+                 .arg(fpsLength, 0, 'f', fpsPrecision)
+                 .arg(fpsUnit));
 
 }
 //------------------------------------------------------------------------
-void GMapDialog::appendWaypointInfo(QStandardItem *it, const GpxWaypoint &wpt)
+void GMapDialog::appendWaypointInfo(QStandardItem* it, const GpxWaypoint& wpt)
 {
   it->appendRow(new StandardItem(tr("Lat: %1").arg(wpt.getLocation().lat(), 0, 'f', 7)));
   it->appendRow(new StandardItem(tr("Lng: %1").arg(wpt.getLocation().lng(), 0, 'f', 7)));
-  if (wpt.getDescription() != QString())
+  if (wpt.getDescription() != QString()) {
     it->appendRow(new StandardItem(tr("Desc: %1").arg(wpt.getDescription())));
-  if (wpt.getComment() != QString() && wpt.getComment() != wpt.getDescription())
+  }
+  if (wpt.getComment() != QString() && wpt.getComment() != wpt.getDescription()) {
     it->appendRow(new StandardItem(tr("Cmt: %1").arg(wpt.getComment())));
-  if (wpt.getElevation() > -50000)
+  }
+  if (wpt.getElevation() > -50000) {
     it->appendRow(new StandardItem(tr("Ele: %1").arg(wpt.getElevation())));
+  }
 
 }
 
 //------------------------------------------------------------------------
-void GMapDialog::appendTrackInfo(QStandardItem *it, const GpxTrack &trk)
+void GMapDialog::appendTrackInfo(QStandardItem* it, const GpxTrack& trk)
 {
   QDateTime startTime, stopTime;
   bool first = true;
   int count = 0;
-  foreach (const GpxTrackSegment &seg, trk.getTrackSegments()) {
-    foreach (const GpxTrackPoint &pt, seg.getTrackPoints()) {
+  foreach (const GpxTrackSegmentseg, trk.getTrackSegments()) {
+    foreach (const GpxTrackPointpt, seg.getTrackPoints()) {
       count++;
       QDateTime t = pt.getDateTime();
-      if (!t.isValid())
-       continue;
-      if (first) {
-       startTime = t;
-       stopTime = t;
-       first = false;
+      if (!t.isValid()) {
+        continue;
       }
-      else {
-       if (t < startTime)
-         startTime = t;
-       if (t > stopTime)
-         stopTime = t;
+      if (first) {
+        startTime = t;
+        stopTime = t;
+        first = false;
+      } else {
+        if (t < startTime) {
+          startTime = t;
+        }
+        if (t > stopTime) {
+          stopTime = t;
+        }
       }
     }
   }
   if (startTime.isValid()) {
     it->appendRow(new StandardItem(tr("Start: %1")
-                                   .arg(startTime.toString("yyyy-MMM-dd HH:mm:ss"))));
+                                   .arg(startTime.toString("yyyy-MMM-dd HH:mm:ss"))));
     it->appendRow(new StandardItem(tr("Stop: %1")
-                                   .arg(stopTime.toString("yyyy-MMM-dd HH:mm:ss"))));
+                                   .arg(stopTime.toString("yyyy-MMM-dd HH:mm:ss"))));
   }
   it->appendRow(new StandardItem(tr("Points: %1").arg(count)));
 
@@ -127,20 +132,20 @@ void GMapDialog::appendTrackInfo(QStandardItem *it, const GpxTrack &trk)
 }
 
 //------------------------------------------------------------------------
-void GMapDialog::appendRouteInfo(QStandardItem *it, const GpxRoute &rte)
+void GMapDialog::appendRouteInfo(QStandardItem* it, const GpxRoute& rte)
 {
   it->appendRow(new StandardItem(formatLength(rte.length())));
 }
 
 //------------------------------------------------------------------------
-GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEdit *te): QDialog(parent)
+GMapDialog::GMapDialog(QWidget* parent, const QString& gpxFileName, QPlainTextEdit* te): QDialog(parent)
 {
   ui_.setupUi(this);
   this->setWindowTitle(QString(appName) + " " + QString("Google Maps"));
   gpx_.read(gpxFileName);
 
   mapWidget_ = new Map(this, gpx_, te);
-  QHBoxLayout *lay = new QHBoxLayout(ui_.frame);
+  QHBoxLayoutlay = new QHBoxLayout(ui_.frame);
   lay->setContentsMargins(0, 0, 0, 0);
   lay->addWidget(mapWidget_);
 
@@ -152,12 +157,12 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd
   wptItem_->setCheckState(Qt::Checked);
   model_->appendRow(wptItem_);
   for (int i=0; i<gpx_.getWaypoints().size(); i++) {
-    GpxWaypoint &wpt = gpx_.getWaypoints()[i];
-    QStandardItem *it = new StandardItem(wpt.getName());
+    GpxWaypointwpt = gpx_.getWaypoints()[i];
+    QStandardItemit = new StandardItem(wpt.getName());
     wptItem_->appendRow(it);
     it->setCheckable(true);
     it->setCheckState(Qt::Checked);
-    it->setData(qVariantFromValue((void *)&wpt));
+    it->setData(qVariantFromValue((void*)&wpt));
     appendWaypointInfo(it, wpt);
     wptList_ << it;
   }
@@ -167,12 +172,12 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd
   trkItem_->setCheckState(Qt::Checked);
   model_->appendRow(trkItem_);
   for (int i=0; i<gpx_.getTracks().size(); i++) {
-    GpxTrack &trk = gpx_.getTracks()[i];
-    QStandardItem *it = new StandardItem(trk.getName());
+    GpxTracktrk = gpx_.getTracks()[i];
+    QStandardItemit = new StandardItem(trk.getName());
     trkItem_->appendRow(it);
     it->setCheckable(true);
     it->setCheckState(Qt::Checked);
-    it->setData(qVariantFromValue((void *)&trk));
+    it->setData(qVariantFromValue((void*)&trk));
     appendTrackInfo(it, trk);
     trkList_ << it;
   }
@@ -182,12 +187,12 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd
   rteItem_->setCheckState(Qt::Checked);
   model_->appendRow(rteItem_);
   for (int i=0; i<gpx_.getRoutes().size(); i++) {
-    GpxRoute &rte = gpx_.getRoutes()[i];
-    QStandardItem *it = new StandardItem(rte.getName());
+    GpxRouterte = gpx_.getRoutes()[i];
+    QStandardItemit = new StandardItem(rte.getName());
     rteItem_->appendRow(it);
     it->setCheckable(true);
     it->setCheckState(Qt::Checked);
-    it->setData(qVariantFromValue((void *)&rte));
+    it->setData(qVariantFromValue((void*)&rte));
     appendRouteInfo(it, rte);
     rteList_ << it;
   }
@@ -195,19 +200,19 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd
   ui_.treeView->header()->hide();
   ui_.treeView->setModel(model_);
   ui_.treeView->setExpandsOnDoubleClick(false);
-  connect(model_, SIGNAL(itemChanged(QStandardItem *)),
-         this,  SLOT(itemChangedX(QStandardItem *)));
+  connect(model_, SIGNAL(itemChanged(QStandardItem*)),
+          this,  SLOT(itemChangedX(QStandardItem*)));
   connect(mapWidget_, SIGNAL(waypointClicked(int)), this, SLOT(waypointClickedX(int)));
   connect(mapWidget_, SIGNAL(routeClicked(int)), this, SLOT(routeClickedX(int)));
   connect(mapWidget_, SIGNAL(trackClicked(int)), this, SLOT(trackClickedX(int)));
-  connect(ui_.treeView, SIGNAL(doubleClicked(const QModelIndex &)),
-         this, SLOT(treeDoubleClicked(const QModelIndex&)));
-  connect(ui_.treeView->selectionModel(), SIGNAL(selectionChanged (const QItemSelection &,  const QItemSelection &)),
-         this, SLOT(selectionChangedX(const QItemSelection &,  const QItemSelection &)));
-                                               
+  connect(ui_.treeView, SIGNAL(doubleClicked(const QModelIndex&)),
+          this, SLOT(treeDoubleClicked(const QModelIndex&)));
+  connect(ui_.treeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,  const QItemSelection&)),
+          this, SLOT(selectionChangedX(const QItemSelection&,  const QItemSelection&)));
+
   ui_.treeView->setContextMenuPolicy(Qt::CustomContextMenu);
-  connect(ui_.treeView, SIGNAL(customContextMenuRequested(const QPoint &)),
-         this, SLOT(showContextMenu(const QPoint &)));
+  connect(ui_.treeView, SIGNAL(customContextMenuRequested(const QPoint&)),
+          this, SLOT(showContextMenu(const QPoint&)));
 
   connect(ui_.copyButton, SIGNAL(clicked()), this, SLOT(copyButtonClickedX()));
 
@@ -215,88 +220,94 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd
 }
 
 //-------------------------------------------------------------------------
-void GMapDialog::itemChangedX(QStandardItem *it)
+void GMapDialog::itemChangedX(QStandardItemit)
 {
   bool show = (it->checkState() == Qt::Checked);
   if (it == trkItem_) {
-    if (show)
+    if (show) {
       mapWidget_->showTracks(gpx_.getTracks());
-    else
+    } else {
       mapWidget_->hideAllTracks();
+    }
   }
 
   else if (it == wptItem_) {
-    if (show)
+    if (show) {
       mapWidget_->showWaypoints(gpx_.getWaypoints());
-    else
+    } else {
       mapWidget_->hideAllWaypoints();
+    }
   }
 
   else if (it == rteItem_) {
-    if (show)
+    if (show) {
       mapWidget_->showRoutes(gpx_.getRoutes());
-    else
+    } else {
       mapWidget_->hideAllRoutes();
+    }
   }
 
   else {
     // Individual items, find the right one.
-    GpxItem *git = static_cast<GpxItem *>(it->data().value<void *>());
+    GpxItem* git = static_cast<GpxItem*>(it->data().value<void*>());
     if (git != 0) {
       git->setVisible(show);
       for (int i=0; i<gpx_.getWaypoints().size(); i++) {
-       if (&gpx_.getWaypoints()[i] == git) {
-         mapWidget_->setWaypointVisibility(i, show);
-       }
+        if (&gpx_.getWaypoints()[i] == git) {
+          mapWidget_->setWaypointVisibility(i, show);
+        }
       }
       for (int i=0; i<gpx_.getTracks().size(); i++) {
-       if (&gpx_.getTracks()[i] == git) {
-         mapWidget_->setTrackVisibility(i, show);
-       }
+        if (&gpx_.getTracks()[i] == git) {
+          mapWidget_->setTrackVisibility(i, show);
+        }
       }
       for (int i=0; i<gpx_.getRoutes().size(); i++) {
-       if (&gpx_.getRoutes()[i] == git) {
-         mapWidget_->setRouteVisibility(i, show);
-       }
+        if (&gpx_.getRoutes()[i] == git) {
+          mapWidget_->setRouteVisibility(i, show);
+        }
       }
     }
   }
 }
 
 //-------------------------------------------------------------------------
-int GMapDialog::waypointIndex(QStandardItem *it)
+int GMapDialog::waypointIndex(QStandardItemit)
 {
-  for (int j=0; j<wptList_.size(); j++){
-    if (it == wptList_[j])
+  for (int j=0; j<wptList_.size(); j++) {
+    if (it == wptList_[j]) {
       return j;
+    }
   }
   return -1;
 }
 
 //-------------------------------------------------------------------------
-int GMapDialog::trackIndex(QStandardItem *it)
+int GMapDialog::trackIndex(QStandardItemit)
 {
-  for (int j=0; j<trkList_.size(); j++){
-    if (it == trkList_[j])
+  for (int j=0; j<trkList_.size(); j++) {
+    if (it == trkList_[j]) {
       return j;
+    }
   }
   return -1;
 }
 
 //-------------------------------------------------------------------------
-int GMapDialog::routeIndex(QStandardItem *it)
+int GMapDialog::routeIndex(QStandardItemit)
 {
-  for (int j=0; j<rteList_.size(); j++){
-    if (it == rteList_[j])
+  for (int j=0; j<rteList_.size(); j++) {
+    if (it == rteList_[j]) {
       return j;
+    }
   }
   return -1;
 }
 
 //-------------------------------------------------------------------------
-void GMapDialog::treeDoubleClicked(const QModelIndex &idx)
+void GMapDialog::treeDoubleClicked(const QModelIndexidx)
 {
-  QStandardItem *it = model_->itemFromIndex(idx);
+  QStandardItemit = model_->itemFromIndex(idx);
   int i = waypointIndex(it);
   if (i >= 0) {
     it->setCheckState(Qt::Checked);
@@ -327,7 +338,7 @@ void GMapDialog::treeDoubleClicked(const QModelIndex &idx)
 void GMapDialog::waypointClickedX(int i)
 {
   if (i>=0 && i < wptList_.size()) {
-    QStandardItem *it = wptList_[i];
+    QStandardItemit = wptList_[i];
     QModelIndex idx = model_->indexFromItem(it);
     ui_.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
     ui_.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
@@ -337,7 +348,7 @@ void GMapDialog::waypointClickedX(int i)
 void GMapDialog::trackClickedX(int i)
 {
   if (i>=0 && i <trkList_.size()) {
-    QStandardItem *it = trkList_[i];
+    QStandardItemit = trkList_[i];
     QModelIndex idx = model_->indexFromItem(it);
     ui_.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
     ui_.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
@@ -348,7 +359,7 @@ void GMapDialog::trackClickedX(int i)
 void GMapDialog::routeClickedX(int i)
 {
   if (i>=0 && i <rteList_.size()) {
-    QStandardItem *it = rteList_[i];
+    QStandardItemit = rteList_[i];
     QModelIndex idx = model_->indexFromItem(it);
     ui_.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
     ui_.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
@@ -356,25 +367,27 @@ void GMapDialog::routeClickedX(int i)
 }
 
 //-------------------------------------------------------------------------
-void GMapDialog::selectionChangedX (const QItemSelection &sel,  const QItemSelection &desel)
+void GMapDialog::selectionChangedX(const QItemSelection& sel,  const QItemSelection& desel)
 {
   int k=0;
-  foreach (QStandardItem*w, wptList_) {
+  foreach (QStandardItem* w, wptList_) {
     QModelIndex idx = model_->indexFromItem(w);
-    if (desel.contains(idx))
+    if (desel.contains(idx)) {
       mapWidget_->setWaypointColorBlue(k);
-    if (sel.contains(idx))
+    }
+    if (sel.contains(idx)) {
       mapWidget_->setWaypointColorRed(k);
+    }
     k++;
   }
 }
 
 //------------------------------------------------------------------------
-void GMapDialog::expandCollapseAll(const QList<QStandardItem *> &li,
-                                  QStandardItem *top, bool exp)
+void GMapDialog::expandCollapseAll(const QList<QStandardItem*>& li,
+                                   QStandardItem* top, bool exp)
 {
   ui_.treeView->setExpanded(model_->indexFromItem(top), exp);
-  foreach (QStandardItem*it, li) {
+  foreach (QStandardItem* it, li) {
     QModelIndex idx = model_->indexFromItem(it);
     ui_.treeView->setExpanded(idx, exp);
   }
@@ -413,27 +426,29 @@ void GMapDialog::collapseAllRoutes()
 }
 
 //------------------------------------------------------------------------
-void GMapDialog::checkUncheckAll(const QList<QStandardItem *> &li,
-                                  QStandardItem *top, bool ck)
+void GMapDialog::checkUncheckAll(const QList<QStandardItem*>& li,
+                                 QStandardItem* top, bool ck)
 {
   top->setCheckState(ck ? Qt::Checked: Qt::Unchecked);
-  foreach (QStandardItem*it, li) {
+  foreach (QStandardItem* it, li) {
     it->setCheckState(ck ? Qt::Checked: Qt::Unchecked);
   }
 }
 //------------------------------------------------------------------------
 void GMapDialog::showAllWaypoints()
 {
-  foreach (GpxWaypoint wpt, gpx_.getWaypoints())
+  foreach (GpxWaypoint wpt, gpx_.getWaypoints()) {
     wpt.setVisible(true);
+  }
   checkUncheckAll(wptList_, wptItem_, true);
   mapWidget_->showWaypoints(gpx_.getWaypoints());
 }
 //------------------------------------------------------------------------
 void GMapDialog::showAllTracks()
 {
-  foreach (GpxTrack trk, gpx_.getTracks())
+  foreach (GpxTrack trk, gpx_.getTracks()) {
     trk.setVisible(true);
+  }
   checkUncheckAll(trkList_, trkItem_, true);
   mapWidget_->showTracks(gpx_.getTracks());
 }
@@ -441,8 +456,9 @@ void GMapDialog::showAllTracks()
 //------------------------------------------------------------------------
 void GMapDialog::showAllRoutes()
 {
-  foreach (GpxRoute rte, gpx_.getRoutes())
+  foreach (GpxRoute rte, gpx_.getRoutes()) {
     rte.setVisible(true);
+  }
   checkUncheckAll(rteList_, rteItem_, true);
   mapWidget_->showRoutes(gpx_.getRoutes());
 }
@@ -450,16 +466,18 @@ void GMapDialog::showAllRoutes()
 //------------------------------------------------------------------------
 void GMapDialog::hideAllWaypoints()
 {
-  foreach (GpxWaypoint wpt, gpx_.getWaypoints())
+  foreach (GpxWaypoint wpt, gpx_.getWaypoints()) {
     wpt.setVisible(false);
+  }
   checkUncheckAll(wptList_, wptItem_, false);
   mapWidget_->showWaypoints(gpx_.getWaypoints());
 }
 //------------------------------------------------------------------------
 void GMapDialog::hideAllTracks()
 {
-  foreach (GpxTrack trk, gpx_.getTracks())
+  foreach (GpxTrack trk, gpx_.getTracks()) {
     trk.setVisible(false);
+  }
   checkUncheckAll(trkList_, trkItem_, false);
   mapWidget_->showTracks(gpx_.getTracks());
 
@@ -467,8 +485,9 @@ void GMapDialog::hideAllTracks()
 //------------------------------------------------------------------------
 void GMapDialog::hideAllRoutes()
 {
-  foreach (GpxRoute rte, gpx_.getRoutes())
+  foreach (GpxRoute rte, gpx_.getRoutes()) {
     rte.setVisible(false);
+  }
   checkUncheckAll(rteList_, rteItem_, false);
   mapWidget_->showRoutes(gpx_.getRoutes());
 
@@ -477,7 +496,7 @@ void GMapDialog::hideAllRoutes()
 //------------------------------------------------------------------------
 void GMapDialog::showOnlyThisWaypoint()
 {
-  QList <GpxWaypoint> &tlist = gpx_.getWaypoints();
+  QList <GpxWaypoint>tlist = gpx_.getWaypoints();
   for (int i=0; i<tlist.size(); i++) {
     tlist[i].setVisible(i == menuIndex_? true: false);
     trkList_[i]->setCheckState(i==menuIndex_? Qt::Checked: Qt::Unchecked);
@@ -488,7 +507,7 @@ void GMapDialog::showOnlyThisWaypoint()
 //------------------------------------------------------------------------
 void GMapDialog::showOnlyThisTrack()
 {
-  QList <GpxTrack> &tlist = gpx_.getTracks();
+  QList <GpxTrack>tlist = gpx_.getTracks();
   for (int i=0; i<tlist.size(); i++) {
     tlist[i].setVisible(i == menuIndex_? true: false);
     trkList_[i]->setCheckState(i==menuIndex_? Qt::Checked: Qt::Unchecked);
@@ -500,7 +519,7 @@ void GMapDialog::showOnlyThisTrack()
 //------------------------------------------------------------------------
 void GMapDialog::showOnlyThisRoute()
 {
-  QList <GpxRoute> &rlist = gpx_.getRoutes();
+  QList <GpxRoute>rlist = gpx_.getRoutes();
   for (int i=0; i<rlist.size(); i++) {
     rlist[i].setVisible(i == menuIndex_? true: false);
     rteList_[i]->setCheckState(i==menuIndex_? Qt::Checked: Qt::Unchecked);
@@ -511,10 +530,10 @@ void GMapDialog::showOnlyThisRoute()
 }
 
 //------------------------------------------------------------------------
-void GMapDialog::showContextMenu(const QPoint &pt)
+void GMapDialog::showContextMenu(const QPointpt)
 {
   QModelIndex idx = ui_.treeView->indexAt(pt);
-  QStandardItem *it = model_->itemFromIndex(idx);
+  QStandardItemit = model_->itemFromIndex(idx);
   int j;
   if (model_->indexFromItem(wptItem_) == idx) {
     QMenu menu(this);
@@ -523,45 +542,40 @@ void GMapDialog::showContextMenu(const QPoint &pt)
     menu.addAction(new TreeAction(tr("Expand All"), this, SLOT(expandAllWaypoints()),&menu));
     menu.addAction(new TreeAction(tr("Collapse All"), this, SLOT(collapseAllWaypoints()),&menu));
     menu.exec(ui_.treeView->mapToGlobal(pt));
-  }
-  else if (model_->indexFromItem(rteItem_) == idx) {
+  } else if (model_->indexFromItem(rteItem_) == idx) {
     QMenu menu(this);
     menu.addAction(new TreeAction(tr("Show All Routes"), this, SLOT(showAllRoutes()), &menu));
     menu.addAction(new TreeAction(tr("Hide All Routes"), this, SLOT(hideAllRoutes()),&menu));
     menu.addAction(new TreeAction(tr("Expand All"), this, SLOT(expandAllRoutes()),&menu));
     menu.addAction(new TreeAction(tr("Collapse All"), this, SLOT(collapseAllRoutes()),&menu));
     menu.exec(ui_.treeView->mapToGlobal(pt));
-  }
-  else if (model_->indexFromItem(trkItem_) == idx) {
+  } else if (model_->indexFromItem(trkItem_) == idx) {
     QMenu menu(this);
     menu.addAction(new TreeAction(tr("Show All Tracks"), this, SLOT(showAllTracks()), &menu));
     menu.addAction(new TreeAction(tr("Hide All Tracks"), this, SLOT(hideAllTracks()),&menu));
     menu.addAction(new TreeAction(tr("Expand All"), this, SLOT(expandAllTracks()),&menu));
     menu.addAction(new TreeAction(tr("Collapse All"), this, SLOT(collapseAllTracks()),&menu));
     menu.exec(ui_.treeView->mapToGlobal(pt));
-  }
-  else if ((j = waypointIndex(it)) >=0) {
+  } else if ((j = waypointIndex(it)) >=0) {
     QMenu menu(this);
     menu.addAction(new TreeAction(tr("Show Only This Waypoint"), this, SLOT(showOnlyThisWaypoint()), &menu));
     menuIndex_ = j;
     menu.exec(ui_.treeView->mapToGlobal(pt));
-  }
-  else if ((j = trackIndex(it)) >=0) {
+  } else if ((j = trackIndex(it)) >=0) {
     QMenu menu(this);
     menu.addAction(new TreeAction(tr("Show Only This Track"), this, SLOT(showOnlyThisTrack()), &menu));
     menuIndex_ = j;
     menu.exec(ui_.treeView->mapToGlobal(pt));
-  }
-  else if ((j = routeIndex(it)) >=0) {
+  } else if ((j = routeIndex(it)) >=0) {
     QMenu menu(this);
     menu.addAction(new TreeAction(tr("Show Only This Route"), this, SLOT(showOnlyThisRoute()), &menu));
     menuIndex_ = j;
     menu.exec(ui_.treeView->mapToGlobal(pt));
-  }
-  else {
+  } else {
   }
 }
 //------------------------------------------------------------------------
-void GMapDialog::copyButtonClickedX() {
-  
+void GMapDialog::copyButtonClickedX()
+{
+
 }
index 4f8d61c3a33fd527d7dbad63d19b16de5e0ec809..f403ee6153ee13a3500e199ad72c05c0a7f33a93 100644 (file)
 
 class GMapDialog: public QDialog
 {
-Q_OBJECT
- public:
-  GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEdit *te);
+  Q_OBJECT
+public:
+  GMapDialog(QWidget* parent, const QString& gpxFileName, QPlainTextEdit* te);
 
- private:
+private:
   Ui_GMapDlg ui_;
-  Map *mapWidget_;
-  QStandardItemModel *model_;
-  QStandardItem *wptItem_, *trkItem_, *rteItem_;
-  QList<QStandardItem *> wptList_, trkList_, rteList_;
+  MapmapWidget_;
+  QStandardItemModelmodel_;
+  QStandardItemwptItem_, *trkItem_, *rteItem_;
+  QList<QStandardItem*> wptList_, trkList_, rteList_;
   Gpx gpx_;
   int menuIndex_;
 
-  void appendWaypointInfo(QStandardItem *it, const GpxWaypoint &wpt);
-  void appendTrackInfo(QStandardItem *it, const GpxTrack &trk);
-  void appendRouteInfo(QStandardItem *it, const GpxRoute &rte);
+  void appendWaypointInfo(QStandardItem* it, const GpxWaypoint& wpt);
+  void appendTrackInfo(QStandardItem* it, const GpxTrack& trk);
+  void appendRouteInfo(QStandardItem* it, const GpxRoute& rte);
 
-  int waypointIndex(QStandardItem *it);
-  int trackIndex(QStandardItem *it);
-  int routeIndex(QStandardItem *it);
+  int waypointIndex(QStandardItemit);
+  int trackIndex(QStandardItemit);
+  int routeIndex(QStandardItemit);
   QString formatLength(double l);
 
   //
 private slots:
-  void itemChangedX(QStandardItem *);
+  void itemChangedX(QStandardItem*);
   void waypointClickedX(int i);
   void trackClickedX(int i);
   void routeClickedX(int i);
-  void treeDoubleClicked(const QModelIndex &idx);
-  void selectionChangedX (const QItemSelection &,  const QItemSelection &);
+  void treeDoubleClicked(const QModelIndexidx);
+  void selectionChangedX(const QItemSelection&,  const QItemSelection&);
   void copyButtonClickedX();
-  void showContextMenu(const QPoint &);
+  void showContextMenu(const QPoint&);
 
 
-  void expandCollapseAll(const QList<QStandardItem *> &li, 
-                        QStandardItem *it, bool exp);
-  void checkUncheckAll(const QList<QStandardItem *> &li, 
-                      QStandardItem *it, bool exp);
+  void expandCollapseAll(const QList<QStandardItem*>& li,
+                         QStandardItem* it, bool exp);
+  void checkUncheckAll(const QList<QStandardItem*>& li,
+                       QStandardItem* it, bool exp);
   void expandAllWaypoints();
   void expandAllTracks();
   void expandAllRoutes();
index a634733d3fbf8a3e56c8b9ab207525e821b5d480..afc2d6fdd11a04f5dd08762ec4bee231193b09c5 100644 (file)
@@ -35,7 +35,8 @@ static QDateTime decodeDateTime(const QString s)
   return utc;
 }
 
-static bool trackIsEmpty(const GpxTrack &trk){
+static bool trackIsEmpty(const GpxTrack& trk)
+{
   int count = 0;
   for (int i=0; i< trk.getTrackSegments().size(); i++) {
     for (int j=0; j<trk.getTrackSegments()[i].getTrackPoints().size(); j++) {
@@ -55,7 +56,8 @@ public:
   }
 
   typedef enum {e_noop, e_wpt, e_trk,
-               e_trkpt, e_trkseg, e_rte, e_rtept} elementState;
+                e_trkpt, e_trkseg, e_rte, e_rtept
+               } elementState;
   QString textChars;
   GpxWaypoint currentWpt;
   QList <GpxWaypoint> wptList;
@@ -72,9 +74,9 @@ public:
   elementState state;
   QList <elementState> stateStack;
 
-  virtual bool startElement (const QString & ,
-                 const QString & localName, const QString &,
-                            const QXmlAttributes & atts )
+  virtual bool startElement(const QString&,
+                            const QString& localName, const QString&,
+                            const QXmlAttributes& atts)
   {
     if (localName == "wpt") {
       currentWpt = GpxWaypoint();
@@ -123,48 +125,40 @@ public:
 
 
     else if (state == e_wpt ||
-            state == e_trkpt || state == e_trkseg || state == e_trk ||
-            state == e_rte || state == e_rtept) {
-    }
-    else {
+             state == e_trkpt || state == e_trkseg || state == e_trk ||
+             state == e_rte || state == e_rtept) {
+    } else {
       //fprintf(stderr, "localName:  %s     name:  %s\n",
       //localName.toStdString().c_str(), qName.toStdString().c_str());
     }
     return true;
   };
 
-  virtual bool endElement (const QString & ,
-                          const QString & localName,
-               const QString &)
+  virtual bool endElement(const QString&,
+                          const QString& localName,
+                          const QString&)
   {
     if (localName == "wpt") {
       state = stateStack.takeLast();
       wptList << currentWpt;
-    }
-    else if (localName == "ele" && state == e_wpt) {
+    } else if (localName == "ele" && state == e_wpt) {
       currentWpt.setElevation(textChars.toDouble());
-    }
-    else if (localName == "name" && state == e_wpt) {
+    } else if (localName == "name" && state == e_wpt) {
       currentWpt.setName(textChars);
-    }
-    else if (localName == "cmt" && state == e_wpt) {
+    } else if (localName == "cmt" && state == e_wpt) {
       currentWpt.setComment(textChars);
-    }
-    else if (localName == "desc" && state == e_wpt) {
+    } else if (localName == "desc" && state == e_wpt) {
       currentWpt.setDescription(textChars);
-    }
-    else if (localName == "sym" && state == e_wpt) {
+    } else if (localName == "sym" && state == e_wpt) {
       currentWpt.setSymbol(textChars);
     }
 
     else if (localName == "trkpt") {
       state = stateStack.takeLast();
       currentTrkSeg.addPoint(currentTrkPt);
-    }
-    else if (localName == "ele" && state == e_trkpt) {
+    } else if (localName == "ele" && state == e_trkpt) {
       currentTrkPt.setElevation(textChars.toDouble());
-    }
-    else if (localName == "time" && state == e_trkpt) {
+    } else if (localName == "time" && state == e_trkpt) {
       currentTrkPt.setDateTime(decodeDateTime(textChars));
     }
 
@@ -175,21 +169,22 @@ public:
 
     else if (localName == "trk") {
       state = stateStack.takeLast();
-      if (!trackIsEmpty(currentTrk))
-       trkList << currentTrk;
+      if (!trackIsEmpty(currentTrk)) {
+        trkList << currentTrk;
+      }
     }
 
     else if (localName == "name" && state == e_trk) {
       currentTrk.setName(textChars);
-    }
-    else if (localName == "number" && state == e_trk) {
+    } else if (localName == "number" && state == e_trk) {
       currentTrk.setNumber(textChars.toInt());
     }
 
     else if (localName == "rte") {
       state = stateStack.takeLast();
-      if (currentRte.getRoutePoints().size()>=2)
-       rteList << currentRte;
+      if (currentRte.getRoutePoints().size()>=2) {
+        rteList << currentRte;
+      }
     }
 
     else if (localName == "rtept") {
@@ -212,7 +207,7 @@ public:
     return true;
   };
 
-  virtual bool characters(const QString &x)
+  virtual bool characters(const QStringx)
   {
     textChars = x;
     return true;
@@ -222,11 +217,12 @@ public:
 
 //------------------------------------------------------------------------
 
-bool Gpx::read(const QString & fileName)
+bool Gpx::read(const QString& fileName)
 {
   QFile file(fileName);
-  if (!file.open(QIODevice::ReadOnly))
+  if (!file.open(QIODevice::ReadOnly)) {
     return false;
+  }
 
   QXmlInputSource xmlIn(&file);
 
@@ -239,7 +235,7 @@ bool Gpx::read(const QString & fileName)
     tracks = gpxHandler.trkList;
     routes = gpxHandler.rteList;
     return true;
-  }
-  else
+  } else {
     return false;
+  }
 }
index 03dda8299f7ced3dec09155fca40c52a8523e130..525388be0872980fe3db7992341e1ae3a1c24fd6 100644 (file)
--- a/gui/gpx.h
+++ b/gui/gpx.h
 #include "latlng.h"
 
 //------------------------------------------------------------------------
-class GpxItem {
- public:
- GpxItem(): visible(true) {};
- GpxItem(bool visible ): visible(visible) {};
-  
-  void setVisible(bool b) { visible = b; };
-  bool getVisible() const { return visible;};
-  
- protected:
-    bool visible;
+class GpxItem
+{
+public:
+  GpxItem(): visible(true) {};
+  GpxItem(bool visible): visible(visible) {};
+
+  void setVisible(bool b)
+  {
+    visible = b;
+  };
+  bool getVisible() const
+  {
+    return visible;
+  };
+
+protected:
+  bool visible;
 };
 
 //------------------------------------------------------------------------
 class GpxRoutePoint: public GpxItem
 {
- public:
+public:
   GpxRoutePoint(): GpxItem(), location(LatLng()), name(QString())
-    {
-    };
-  void setLocation(const LatLng& pt) { location = pt; };
-  LatLng getLocation() const { return location; };
+  {
+  };
+  void setLocation(const LatLng& pt)
+  {
+    location = pt;
+  };
+  LatLng getLocation() const
+  {
+    return location;
+  };
 
-  void setName(const QString &s) { name = s; };
-  QString getName () const { return name; };
+  void setName(const QString& s)
+  {
+    name = s;
+  };
+  QString getName() const
+  {
+    return name;
+  };
 
- private:
+private:
   LatLng location;
   QString name;
 };
@@ -61,62 +80,76 @@ class GpxRoutePoint: public GpxItem
 //------------------------------------------------------------------------
 class GpxRoute: public GpxItem
 {
- public:
+public:
   GpxRoute(): GpxItem(),name(QString()), cachedLength(-1) {};
 
- GpxRoute(const GpxRoute &c)
-   :GpxItem(c.visible),
-    name(c.name), cachedLength(c.cachedLength)
-      {
-       routePoints.clear();
-       foreach (GpxRoutePoint sg, c.routePoints)
-         routePoints << sg;
-      }
-  GpxRoute & operator = (const GpxRoute &c) 
-    {
-      visible = c.visible;
-      name = c.name; 
-      cachedLength = c.cachedLength;
-      routePoints.clear();
-      foreach (GpxRoutePoint sg, c.routePoints) {
-       routePoints << sg;
-      }
-      return *this;
+  GpxRoute(const GpxRoute& c)
+    :GpxItem(c.visible),
+     name(c.name), cachedLength(c.cachedLength)
+  {
+    routePoints.clear();
+    foreach (GpxRoutePoint sg, c.routePoints) {
+      routePoints << sg;
     }
+  }
+  GpxRoute& operator = (const GpxRoute& c)
+  {
+    visible = c.visible;
+    name = c.name;
+    cachedLength = c.cachedLength;
+    routePoints.clear();
+    foreach (GpxRoutePoint sg, c.routePoints) {
+      routePoints << sg;
+    }
+    return *this;
+  }
 
   double length() const
   {
-    if (cachedLength >=0.0)
+    if (cachedLength >=0.0) {
       return cachedLength;
+    }
     LatLng prevPt;
     bool first = true;
     double dist = 0.0;
     foreach (GpxRoutePoint pt, routePoints) {
       if (first) {
-       prevPt = pt.getLocation();
-       first = false;
-      }
-      else {
-       LatLng thisPt = pt.getLocation();
-       dist += prevPt.haversineDistance(thisPt);
-       prevPt = thisPt;
+        prevPt = pt.getLocation();
+        first = false;
+      } else {
+        LatLng thisPt = pt.getLocation();
+        dist += prevPt.haversineDistance(thisPt);
+        prevPt = thisPt;
       }
     }
-    double *dptr = (double *)(&cachedLength); // big cheat
+    double* dptr = (double*)(&cachedLength);  // big cheat
     *dptr = dist;
     return cachedLength;
   }
-  
-  void setName(const QString &s) { name = s; };
-  QString getName() const { return name; };
 
-  void clear() { routePoints.clear(); };
-  void addPoint(const GpxRoutePoint &pt) {
+  void setName(const QString& s)
+  {
+    name = s;
+  };
+  QString getName() const
+  {
+    return name;
+  };
+
+  void clear()
+  {
+    routePoints.clear();
+  };
+  void addPoint(const GpxRoutePoint& pt)
+  {
     routePoints << pt;
   }
-  const QList<GpxRoutePoint> & getRoutePoints() const { return routePoints; };
+  const QList<GpxRoutePoint>& getRoutePoints() const
+  {
+    return routePoints;
+  };
 
- private:
+private:
   QString name;
   QList <GpxRoutePoint> routePoints;
   double cachedLength;
@@ -125,20 +158,38 @@ class GpxRoute: public GpxItem
 //------------------------------------------------------------------------
 class GpxTrackPoint: public GpxItem
 {
- public:
- GpxTrackPoint(): GpxItem(), location(LatLng()), elevation(0), dateTime(QDateTime())
-    {
-    };
-  void setLocation(const LatLng& pt) { location = pt; };
-  LatLng getLocation() const { return location; };
+public:
+  GpxTrackPoint(): GpxItem(), location(LatLng()), elevation(0), dateTime(QDateTime())
+  {
+  };
+  void setLocation(const LatLng& pt)
+  {
+    location = pt;
+  };
+  LatLng getLocation() const
+  {
+    return location;
+  };
 
-  void setElevation(double e) { elevation = e; };
-  double getElevation () const { return elevation; };
+  void setElevation(double e)
+  {
+    elevation = e;
+  };
+  double getElevation() const
+  {
+    return elevation;
+  };
 
-  void setDateTime(const QDateTime &dt) { dateTime = dt; };
-  QDateTime getDateTime() const { return dateTime; };
+  void setDateTime(const QDateTime& dt)
+  {
+    dateTime = dt;
+  };
+  QDateTime getDateTime() const
+  {
+    return dateTime;
+  };
 
- private:
+private:
   LatLng location;
   double  elevation;
   QDateTime dateTime;
@@ -147,106 +198,149 @@ class GpxTrackPoint: public GpxItem
 //------------------------------------------------------------------------
 class GpxTrackSegment: public GpxItem
 {
- public:
+public:
   GpxTrackSegment() {};
- GpxTrackSegment(const GpxTrackSegment &c): GpxItem(c.visible) {
+  GpxTrackSegment(const GpxTrackSegment& c): GpxItem(c.visible)
+  {
     trackPoints.clear();
-    foreach (GpxTrackPoint pt, c.trackPoints)
+    foreach (GpxTrackPoint pt, c.trackPoints) {
       trackPoints << pt;
+    }
   }
-  GpxTrackSegment & operator = (const GpxTrackSegment &c) {
+  GpxTrackSegment& operator = (const GpxTrackSegment& c)
+  {
     visible = c.visible;
     trackPoints.clear();
-    foreach (GpxTrackPoint pt, c.trackPoints)
+    foreach (GpxTrackPoint pt, c.trackPoints) {
       trackPoints << pt;
+    }
     return *this;
   }
-  void addPoint(const GpxTrackPoint & pt) {
+  void addPoint(const GpxTrackPoint& pt)
+  {
     trackPoints << pt;
   }
-  void clear() { trackPoints.clear(); };
-  const QList<GpxTrackPoint> & getTrackPoints() const { return trackPoints; };
+  void clear()
+  {
+    trackPoints.clear();
+  };
+  const QList<GpxTrackPoint>& getTrackPoints() const
+  {
+    return trackPoints;
+  };
 
- private:
+private:
   QList <GpxTrackPoint> trackPoints;
 };
 //------------------------------------------------------------------------
 class GpxTrack: public GpxItem
 {
- public:
+public:
   GpxTrack(): GpxItem(), number(1), name(QString()), comment(QString()), description(QString()), cachedLength(-1.0) {};
 
- GpxTrack(const GpxTrack &c)
-   :GpxItem(c.visible),
-    number(c.number), 
-    name(c.name), 
-    comment(c.comment), 
-    description (c.description),
-    cachedLength(c.cachedLength)
-      {
-       trackSegments.clear();
-       foreach (GpxTrackSegment sg, c.trackSegments)
-         trackSegments << sg;
-      }
-  GpxTrack & operator = (const GpxTrack &c) 
-    {
-      visible = c.visible;
-      number = c.number;
-      name = c.name; 
-      comment = c.comment;
-      description = c.description;
-      cachedLength = c.cachedLength;
-      trackSegments.clear();
-      foreach (GpxTrackSegment sg, c.trackSegments) {
-       trackSegments << sg;
-      }
-      return *this;
+  GpxTrack(const GpxTrack& c)
+    :GpxItem(c.visible),
+     number(c.number),
+     name(c.name),
+     comment(c.comment),
+     description(c.description),
+     cachedLength(c.cachedLength)
+  {
+    trackSegments.clear();
+    foreach (GpxTrackSegment sg, c.trackSegments) {
+      trackSegments << sg;
+    }
+  }
+  GpxTrack& operator = (const GpxTrack& c)
+  {
+    visible = c.visible;
+    number = c.number;
+    name = c.name;
+    comment = c.comment;
+    description = c.description;
+    cachedLength = c.cachedLength;
+    trackSegments.clear();
+    foreach (GpxTrackSegment sg, c.trackSegments) {
+      trackSegments << sg;
     }
+    return *this;
+  }
 
-  void setNumber(int n) { number = n; };
-  int getNumber() const { return number; };
+  void setNumber(int n)
+  {
+    number = n;
+  };
+  int getNumber() const
+  {
+    return number;
+  };
 
-  void setName(const QString &s) { name = s; };
-  QString getName() const { return name; };
+  void setName(const QString& s)
+  {
+    name = s;
+  };
+  QString getName() const
+  {
+    return name;
+  };
 
-  void setComment(const QString &s) { comment = s; };
-  QString getComment() const { return comment; };
+  void setComment(const QString& s)
+  {
+    comment = s;
+  };
+  QString getComment() const
+  {
+    return comment;
+  };
 
-  void setDescription(const QString &s) { description = s; };
-  QString getDescription() const { return description; };
+  void setDescription(const QString& s)
+  {
+    description = s;
+  };
+  QString getDescription() const
+  {
+    return description;
+  };
 
-  void clear() { trackSegments.clear(); };
-  void addSegment(const GpxTrackSegment &seg) {
+  void clear()
+  {
+    trackSegments.clear();
+  };
+  void addSegment(const GpxTrackSegment& seg)
+  {
     trackSegments << seg;
   }
-  const QList<GpxTrackSegment> & getTrackSegments() const { return trackSegments; };
+  const QList<GpxTrackSegment>& getTrackSegments() const
+  {
+    return trackSegments;
+  };
 
   double length() const
   {
-    if (cachedLength >=0.0)
+    if (cachedLength >=0.0) {
       return cachedLength;
+    }
     LatLng prevPt;
     bool first = true;
     double dist = 0.0;
     foreach (GpxTrackSegment seg, trackSegments) {
       foreach (GpxTrackPoint pt, seg.getTrackPoints()) {
-       if (first) {
-         prevPt = pt.getLocation();
-         first = false;
-       }
-       else {
-         LatLng thisPt = pt.getLocation();
-         dist += prevPt.haversineDistance(thisPt);
-         prevPt = thisPt;
-       }
+        if (first) {
+          prevPt = pt.getLocation();
+          first = false;
+        } else {
+          LatLng thisPt = pt.getLocation();
+          dist += prevPt.haversineDistance(thisPt);
+          prevPt = thisPt;
+        }
       }
     }
-    double *dptr = (double *)(&cachedLength); // big cheat
+    double* dptr = (double*)(&cachedLength);  // big cheat
     *dptr = dist;
     return cachedLength;
   }
 
- private:
+private:
   int     number;
   QString name;
   QString comment;
@@ -258,35 +352,71 @@ class GpxTrack: public GpxItem
 //------------------------------------------------------------------------
 class GpxWaypoint: public GpxItem
 {
- public:
- GpxWaypoint(): GpxItem(), 
+public:
+  GpxWaypoint(): GpxItem(),
     location_(LatLng(0, 0)),
-    elevation_ (-1.0E-100),
+    elevation_(-1.0E-100),
     name_(QString()),
     comment_(QString()),
     description_(QString()),
     symbol_(QString())
-      {};
-  
-  void setLocation(const LatLng& pt) { location_ = pt; };
-  LatLng getLocation() const { return location_; };
+  {};
 
-  void setElevation(double e) { elevation_ = e; };
-  double getElevation () const { return elevation_; };
+  void setLocation(const LatLng& pt)
+  {
+    location_ = pt;
+  };
+  LatLng getLocation() const
+  {
+    return location_;
+  };
 
-  void setName(const QString &s) { name_ = s; };
-  QString getName() const { return name_; };
+  void setElevation(double e)
+  {
+    elevation_ = e;
+  };
+  double getElevation() const
+  {
+    return elevation_;
+  };
 
-  void setComment(const QString &s) { comment_ = s; };
-  QString getComment() const { return comment_; };
+  void setName(const QString& s)
+  {
+    name_ = s;
+  };
+  QString getName() const
+  {
+    return name_;
+  };
 
-  void setDescription(const QString &s) { description_ = s; };
-  QString getDescription() const { return description_; };
+  void setComment(const QString& s)
+  {
+    comment_ = s;
+  };
+  QString getComment() const
+  {
+    return comment_;
+  };
+
+  void setDescription(const QString& s)
+  {
+    description_ = s;
+  };
+  QString getDescription() const
+  {
+    return description_;
+  };
 
-  void setSymbol(const QString &s) { symbol_ = s; };
-  QString getSymbol() const { return symbol_; };
+  void setSymbol(const QString& s)
+  {
+    symbol_ = s;
+  };
+  QString getSymbol() const
+  {
+    return symbol_;
+  };
 
- private:
+private:
   LatLng location_;
   double  elevation_;
   QString name_;
@@ -296,20 +426,39 @@ class GpxWaypoint: public GpxItem
 };
 
 //------------------------------------------------------------------------
-class Gpx {
+class Gpx
+{
 public:
   Gpx() {};
-  bool read(const QString & fileName);
-  
-  QList <GpxWaypoint> &getWaypoints()   { return wayPoints; }; // nonconst
-  QList <GpxTrack>    &getTracks()      { return tracks; };
-  QList <GpxRoute>    &getRoutes()      { return routes; };
+  bool read(const QString& fileName);
 
-  const QList <GpxWaypoint> &getWaypoints() const { return wayPoints; };
-  const QList <GpxTrack> &getTracks()       const { return tracks; };
-  const QList <GpxRoute> &getRoutes()       const { return routes; };
+  QList <GpxWaypoint>& getWaypoints()
+  {
+    return wayPoints;
+  }; // nonconst
+  QList <GpxTrack>&    getTracks()
+  {
+    return tracks;
+  };
+  QList <GpxRoute>&    getRoutes()
+  {
+    return routes;
+  };
+
+  const QList <GpxWaypoint>& getWaypoints() const
+  {
+    return wayPoints;
+  };
+  const QList <GpxTrack>& getTracks()       const
+  {
+    return tracks;
+  };
+  const QList <GpxRoute>& getRoutes()       const
+  {
+    return routes;
+  };
 
- private:
+private:
   QList <GpxWaypoint> wayPoints;
   QList <GpxTrack>    tracks;
   QList <GpxRoute>    routes;
index 98fa407f9da178e467dc75c372b7a8a060d85177..f44cac7ac3eb538ed4bd89855135c55d6325c881 100644 (file)
@@ -27,7 +27,7 @@
 #include "format.h"
 
 //------------------------------------------------------------------------
-void ShowHelp(const QString &urlIn)
+void ShowHelp(const QStringurlIn)
 
 {
   QString url = urlIn;
index b9a929ac7f6a41ddb8978f0389e76ff3f178d281..9094c9e139d1412d1300cba65962e315fb1de7e9 100644 (file)
@@ -24,7 +24,7 @@
 #define HELP_H
 #include <QString>
 
-extern void ShowHelp(const QString & name);
+extern void ShowHelp(const QString& name);
 
 
 #endif
index 73b624196823d2106b101338b4ea41bd9ca287c4..de783f9412ff5be056df4be6e2248e55a0ef02b8 100644 (file)
@@ -61,12 +61,13 @@ static double ArcInRadians(const LatLng& from, const LatLng& to)
  *
  * @sa ArcInRadians
  */
-static double DistanceInMeters(const LatLng& from, const LatLng& to) {
+static double DistanceInMeters(const LatLng& from, const LatLng& to)
+{
   return EARTH_RADIUS_IN_METERS*ArcInRadians(from, to);
 }
 //------------------------------------------------------------------------
 
-double LatLng::haversineDistance(const LatLng &other) const
+double LatLng::haversineDistance(const LatLngother) const
 {
   return DistanceInMeters(*this, other);
 }
index a514e1dd15904cdd7dea9f3d90379eafcd4916d3..bc5288842045cb36b7ab36c447858a2649fa7072 100644 (file)
 //------------------------------------------------------------------------
 class LatLng
 {
- public:
- LatLng(): _lat(0), _lng(0) {};
- LatLng(double lat, double lng): _lat(lat), _lng(lng) {};
-  double lat() const { return _lat; }
-  double lng() const { return _lng; }
-  double haversineDistance(const LatLng &other) const;
-  
- private:
+public:
+  LatLng(): _lat(0), _lng(0) {};
+  LatLng(double lat, double lng): _lat(lat), _lng(lng) {};
+  double lat() const
+  {
+    return _lat;
+  }
+  double lng() const
+  {
+    return _lng;
+  }
+  double haversineDistance(const LatLng& other) const;
+
+private:
   double _lat;
   double _lng;
 };
index 9ff9b7cf652b106d45b74403192535fd84951d83..e84f41bb0d1aed96fc2292167ec9da4dc4ac19fa 100644 (file)
@@ -32,9 +32,9 @@
 #include "gmapdlg.h"
 
 #ifdef _WIN32
-const char *pathSeparator = ";";
+const charpathSeparator = ";";
 #else
-const char *pathSeparator = ":";
+const charpathSeparator = ":";
 #endif
 
 #if defined (Q_OS_MAC)
@@ -42,20 +42,20 @@ const char *pathSeparator = ":";
 #endif
 
 //------------------------------------------------------------------------
-int main(int argc, char**argv)
+int main(int argc, char** argv)
 {
 // MIN_QT_VERSION in configure.ac should correspond to the QT_VERSION_CHECK arguments in main.cc and gui/main.cc
 #if (QT_VERSION < QT_VERSION_CHECK(5, 9, 0))
-  #error this version of Qt is not supported.
+#error this version of Qt is not supported.
 #endif
 
-  QApplication *app;
+  QApplicationapp;
   app = new QApplication(argc, argv);
   app->setWindowIcon(QIcon(":/images/appicon.png"));
 
   QString newPath = "PATH=" + QApplication::applicationDirPath() +
-    QString(pathSeparator) + getenv("PATH");
-  char *newPathEnv = new char[newPath.length() + 1];
+                    QString(pathSeparator) + getenv("PATH");
+  charnewPathEnv = new char[newPath.length() + 1];
   strcpy(newPathEnv, newPath.toStdString().c_str());
   putenv(newPathEnv);
 
index e634a8a27a082119e4c238e07baecae1c2855788..47275a6a21e63c86218cf4bfc856c0ee4dee7bdd 100644 (file)
@@ -57,11 +57,13 @@ QString MainWindow::findBabelVersion()
 {
   QProcess babel;
   babel.start("gpsbabel", QStringList() << "-V");
-  if (!babel.waitForStarted())
+  if (!babel.waitForStarted()) {
     return QString();
+  }
   babel.closeWriteChannel();
-  if (!babel.waitForFinished())
+  if (!babel.waitForFinished()) {
     return QString();
+  }
 
   QString str = babel.readAll();
   isBeta_ = str.contains("-beta");
@@ -78,7 +80,7 @@ QString MainWindow::findBabelVersion()
 bool MainWindow::allowBetaUpgrades()
 {
   // If this is a beta version (which means the user consciously downloaded
-  // it and decided to be on the beta track or the user has ticked the 
+  // it and decided to be on the beta track or the user has ticked the
   // 'suggest beta upgrade' box, allow betas to be suggested for installation.
   return isBeta_ || babelData_.allowBetaUpgrades_;
 }
@@ -92,9 +94,9 @@ static QString MakeOptions(const QList<FormatOption>& options)
     QVariant default_value = option.getDefaultValue();
     if (option.getSelected()) {
       // For OPTbool, 'selected' is the key, not value.
-     if (option.getType() == FormatOption::OPTbool) {
-       // Only write "foo=1" if that's not already the default.
-       if (default_value != "1") {
+      if (option.getType() == FormatOption::OPTbool) {
+        // Only write "foo=1" if that's not already the default.
+        if (default_value != "1") {
           str += "," + option.getName() + "=1";
         }
       } else {
@@ -107,10 +109,10 @@ static QString MakeOptions(const QList<FormatOption>& options)
       if (option.getType() == FormatOption::OPTbool &&
           default_value != "0" &&
           default_value != "") {
-            str += "," + option.getName() + "=0";
-        }
+        str += "," + option.getName() + "=0";
       }
     }
+  }
   return str;
 }
 
@@ -151,15 +153,15 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent)
   connect(ui_.actionPreferences, SIGNAL(triggered()), this, SLOT(preferencesActionX()));
 
   connect(ui_.inputFormatCombo,  SIGNAL(currentIndexChanged(int)),
-         this,                 SLOT(inputFormatChanged(int)));
+          this,                 SLOT(inputFormatChanged(int)));
   connect(ui_.outputFormatCombo, SIGNAL(currentIndexChanged(int)),
-         this,                 SLOT(outputFormatChanged(int)));
+          this,                 SLOT(outputFormatChanged(int)));
   connect(ui_.inputOptionsBtn,   SIGNAL(clicked()),
-         this,                 SLOT(inputOptionButtonClicked()));
-  connect(ui_.outputOptionsBtn , SIGNAL(clicked()),
-         this,                 SLOT(outputOptionButtonClicked()));
-  connect(ui_.moreOptionButton , SIGNAL(clicked()),
-         this,                 SLOT(moreOptionButtonClicked()));
+          this,                 SLOT(inputOptionButtonClicked()));
+  connect(ui_.outputOptionsBtn, SIGNAL(clicked()),
+          this,                 SLOT(outputOptionButtonClicked()));
+  connect(ui_.moreOptionButton, SIGNAL(clicked()),
+          this,                 SLOT(moreOptionButtonClicked()));
 
   connect(ui_.buttonBox, SIGNAL(accepted()), this, SLOT(applyActionX()));
   connect(ui_.buttonBox, SIGNAL(rejected()), this, SLOT(closeActionX()));
@@ -224,49 +226,50 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent)
 //------------------------------------------------------------------------
 MainWindow::~MainWindow()
 {
-  if (upgrade)
+  if (upgrade) {
     delete upgrade;
+  }
 }
 //------------------------------------------------------------------------
-// Dynamic language switching courtesy of 
+// Dynamic language switching courtesy of
 // http://developer.qt.nokia.com/wiki/How_to_create_a_multi_language_application
-// We create the menu entries dynamically, dependant on the existing 
+// We create the menu entries dynamically, dependant on the existing
 // translations.
 #if FAKE_LANGUAGE_MENU
 void MainWindow::createLanguageMenu(void)
 {
-    QActionGroup* langGroup = new QActionGroup(ui.menuHelp);
-    langGroup->setExclusive(true);
-    connect(langGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotLanguageChanged(QAction *)));
+  QActionGroup* langGroup = new QActionGroup(ui.menuHelp);
+  langGroup->setExclusive(true);
+  connect(langGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotLanguageChanged(QAction*)));
 
-    // format systems language
-    QString defaultLocale = QLocale::system().name();       // e.g. "de_DE"
-    defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
+  // format systems language
+  QString defaultLocale = QLocale::system().name();       // e.g. "de_DE"
+  defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
 
-    QDir dir(langPath);
-    QStringList fileNames = dir.entryList(QStringList("GPSBabelFE*.qm"));
+  QDir dir(langPath);
+  QStringList fileNames = dir.entryList(QStringList("GPSBabelFE*.qm"));
 
-    for (int i = 0; i < fileNames.size(); ++i) {
-        // get locale extracted by filename
-        QString locale;
-        locale = fileNames[i];                  // "TranslationExample_de.qm"
-        locale.truncate(locale.lastIndexOf('.'));   // "TranslationExample_de"
-        locale.remove(0, locale.indexOf('_') + 1);   // "de"
+  for (int i = 0; i < fileNames.size(); ++i) {
+    // get locale extracted by filename
+    QString locale;
+    locale = fileNames[i];                  // "TranslationExample_de.qm"
+    locale.truncate(locale.lastIndexOf('.'));   // "TranslationExample_de"
+    locale.remove(0, locale.indexOf('_') + 1);   // "de"
 
-        QString lang = QLocale::languageToString(QLocale(locale).language());
+    QString lang = QLocale::languageToString(QLocale(locale).language());
 
-        QAction *action = new QAction(lang, this);
-        action->setCheckable(true);
-        action->setData(locale);
+    QAction* action = new QAction(lang, this);
+    action->setCheckable(true);
+    action->setData(locale);
 
-        ui.menuHelp->addAction(action);
-        langGroup->addAction(action);
+    ui.menuHelp->addAction(action);
+    langGroup->addAction(action);
 
-        // set default translators and language checked
-        if (defaultLocale == locale) {
-            action->setChecked(true);
-        }
+    // set default translators and language checked
+    if (defaultLocale == locale) {
+      action->setChecked(true);
     }
+  }
 }
 #endif //  FAKE_LANGUAGE_MENU
 
@@ -288,8 +291,9 @@ void MainWindow::switchTranslator(QTranslator& translator, const QString& filena
   QString full_filename(langPath_ + "/" + filename);
 
   // load the new translator
-  if (translator.load(full_filename))
+  if (translator.load(full_filename)) {
     qApp->installTranslator(&translator);
+  }
 }
 
 void MainWindow::loadLanguage(const QString& rLanguage)
@@ -307,52 +311,55 @@ void MainWindow::loadLanguage(const QString& rLanguage)
 
 void MainWindow::changeEvent(QEvent* event)
 {
-    if (0 != event) {
-        switch(event->type()) {
-        // This event is sent if a translator is loaded.
-        case QEvent::LanguageChange:
-            ui_.retranslateUi(this);
-            break;
-        // This event is sent if the system language changes.
-        case QEvent::LocaleChange:
-            {
-                QString locale = QLocale::system().name();
-                locale.truncate(locale.lastIndexOf('_'));
-                loadLanguage(locale);
-            }
-           break;
-        default:
-           break;
-        }
+  if (0 != event) {
+    switch (event->type()) {
+    // This event is sent if a translator is loaded.
+    case QEvent::LanguageChange:
+      ui_.retranslateUi(this);
+      break;
+    // This event is sent if the system language changes.
+    case QEvent::LocaleChange: {
+      QString locale = QLocale::system().name();
+      locale.truncate(locale.lastIndexOf('_'));
+      loadLanguage(locale);
     }
-    QMainWindow::changeEvent(event);
+    break;
+    default:
+      break;
+    }
+  }
+
+  QMainWindow::changeEvent(event);
 }
 
 //------------------------------------------------------------------------
-void MainWindow::loadInputDeviceNameCombo(const QString &format)
+void MainWindow::loadInputDeviceNameCombo(const QStringformat)
 {
   ui_.inputDeviceNameCombo->clear();
-  // Later, we can probe the system for multiple USB devices and populate 
+  // Later, we can probe the system for multiple USB devices and populate
   // here.
-  if (formatSupportsUSB(format))
+  if (formatSupportsUSB(format)) {
     ui_.inputDeviceNameCombo->addItem("usb:");
-  if (formatSupportsSerial(format))
+  }
+  if (formatSupportsSerial(format)) {
     osLoadDeviceNameCombos(ui_.inputDeviceNameCombo);
+  }
   // If only one choice, just disable it.
   ui_.inputDeviceNameCombo->setEnabled(ui_.inputDeviceNameCombo->count() > 1);
 }
 
 //------------------------------------------------------------------------
-void MainWindow::loadOutputDeviceNameCombo(const QString &format)
+void MainWindow::loadOutputDeviceNameCombo(const QStringformat)
 {
   ui_.outputDeviceNameCombo->clear();
-  // Later, we can probe the system for multiple USB devices and populate 
+  // Later, we can probe the system for multiple USB devices and populate
   // here.
-  if (formatSupportsUSB(format))
+  if (formatSupportsUSB(format)) {
     ui_.outputDeviceNameCombo->addItem("usb:");
-  if (formatSupportsSerial(format))
+  }
+  if (formatSupportsSerial(format)) {
     osLoadDeviceNameCombos(ui_.outputDeviceNameCombo);
+  }
   // If only one choice, just disable it.
   ui_.outputDeviceNameCombo->setEnabled(ui_.outputDeviceNameCombo->count() > 1);
 }
@@ -373,8 +380,9 @@ void MainWindow::inputFileOptBtnClicked()
   ui_.inputFormatCombo->clear();
   for (int i=0; i<indices.size(); i++) {
     int k = indices[i];
-    if (!formatList_[k].isHidden())
+    if (!formatList_[k].isHidden()) {
       ui_.inputFormatCombo->addItem(formatList_[k].getDescription(), QVariant(k));
+    }
   }
   setComboToFormat(ui_.inputFormatCombo, fmt, true);
   fmtChgInterlock_ = false;
@@ -390,8 +398,9 @@ void MainWindow::inputDeviceOptBtnClicked()
   ui_.inputFormatCombo->clear();
   for (int i=0; i<indices.size(); i++) {
     int k = indices[i];
-    if (!formatList_[k].isHidden())
+    if (!formatList_[k].isHidden()) {
       ui_.inputFormatCombo->addItem(formatList_[k].getDescription(), QVariant(k));
+    }
   }
   setComboToFormat(ui_.inputFormatCombo, fmt, false);
   fmtChgInterlock_ = false;
@@ -410,12 +419,12 @@ void MainWindow:: outputFileOptBtnClicked()
     ui_.outputFormatCombo->clear();
     for (int i=0; i<indices.size(); i++) {
       int k = indices[i];
-      if (!formatList_[k].isHidden())
+      if (!formatList_[k].isHidden()) {
         ui_.outputFormatCombo->addItem(formatList_[k].getDescription(), QVariant(k));
+      }
     }
     setComboToFormat(ui_.outputFormatCombo, fmt, true);
-  }
-  else {
+  } else {
     ui_.outputStackedWidget->setCurrentWidget(ui_.outputFilePage);
     ui_.outputFilePage->setEnabled(false);
   }
@@ -435,12 +444,12 @@ void MainWindow:: outputDeviceOptBtnClicked()
     ui_.outputFormatCombo->clear();
     for (int i=0; i<indices.size(); i++) {
       int k = indices[i];
-      if (!formatList_[k].isHidden())
+      if (!formatList_[k].isHidden()) {
         ui_.outputFormatCombo->addItem(formatList_[k].getDescription(), QVariant(k));
+      }
     }
     setComboToFormat(ui_.outputFormatCombo, fmt, false);
-  }
-  else {
+  } else {
     ui_.outputStackedWidget->setCurrentWidget(ui_.outputDevicePage);
     ui_.outputDevicePage->setEnabled(false);
   }
@@ -471,8 +480,9 @@ QString MainWindow::filterForFormat(int idx)
   if (extensions.size() > 0 && !extensions[0].isEmpty()) {
     str += " (";
     for (int i=0; i<extensions.size(); i++) {
-      if (i!= 0)
+      if (i!= 0) {
         str += " ";
+      }
       str += "*." + extensions[i];
     }
     str += ");;";
@@ -481,30 +491,32 @@ QString MainWindow::filterForFormat(int idx)
   return str;
 }
 //------------------------------------------------------------------------
-QString MainWindow::ensureExtensionPresent(const QString &name, int idx)
+QString MainWindow::ensureExtensionPresent(const QStringname, int idx)
 {
   QString outname = name;
   if (QFileInfo(name).suffix().length() == 0) {
     QStringList extensions = formatList_[idx].getExtensions();
-    if (extensions.size() > 0 && !extensions[0].isEmpty())
+    if (extensions.size() > 0 && !extensions[0].isEmpty()) {
       outname += "." + extensions[0];
+    }
   }
   return outname;
 }
 
 //------------------------------------------------------------------------
-bool MainWindow::filterForFormatIncludes(int idx, const QString &fmt)
+bool MainWindow::filterForFormatIncludes(int idx, const QStringfmt)
 {
   QStringList extensions = formatList_[idx].getExtensions();
   for (int i=0; i<extensions.size(); i++) {
-    if (fmt == extensions[i])
+    if (fmt == extensions[i]) {
       return true;
+    }
   }
   return false;
 }
 
 //------------------------------------------------------------------------
-int MainWindow::currentComboFormatIndex(QComboBox *comboBox)
+int MainWindow::currentComboFormatIndex(QComboBoxcomboBox)
 {
   int idx = comboBox->currentIndex();
   if (idx<0 || idx >= comboBox->count()) {
@@ -525,15 +537,16 @@ void MainWindow::browseInputFile()
 
   QStringList userList =
     QFileDialog::getOpenFileNames(0, tr("Select one or more input files"),
-                                 startFile,
-                                 filterForFormat(idx));
+                                  startFile,
+                                  filterForFormat(idx));
   if (userList.size()) {
     babelData_.inputBrowse_ = userList[0];
     babelData_.inputFileNames_ = userList;
     QString str;
     for (int i=0; i<babelData_.inputFileNames_.size(); i++) {
-      if (i != 0)
+      if (i != 0) {
         str += ", ";
+      }
       str += "\"" + babelData_.inputFileNames_[i] + "\"";
     }
     ui_.inputFileNameText->setText(str);
@@ -552,8 +565,8 @@ void MainWindow::browseOutputFile()
 
   QString str =
     QFileDialog::getSaveFileName(0, tr("Output File Name"),
-                                startFile,
-                                filterForFormat(idx));
+                                 startFile,
+                                 filterForFormat(idx));
   if (str.length() != 0) {
     str = ensureExtensionPresent(str, idx);
     babelData_.outputBrowse_ = str;
@@ -567,8 +580,9 @@ QList<int> MainWindow::inputFileFormatIndices()
 {
   QList<int>indices;
   for (int i=0; i<formatList_.size(); i++) {
-    if (formatList_[i].isReadSomething() && formatList_[i].isFileFormat())
+    if (formatList_[i].isReadSomething() && formatList_[i].isFileFormat()) {
       indices<<i;
+    }
   }
   return indices;
 }
@@ -578,8 +592,9 @@ QList<int> MainWindow::inputDeviceFormatIndices()
 {
   QList<int>indices;
   for (int i=0; i<formatList_.size(); i++) {
-    if (formatList_[i].isReadSomething() && formatList_[i].isDeviceFormat())
+    if (formatList_[i].isReadSomething() && formatList_[i].isDeviceFormat()) {
       indices<<i;
+    }
   }
   return indices;
 }
@@ -589,8 +604,9 @@ QList<int> MainWindow::outputFileFormatIndices()
 {
   QList<int>indices;
   for (int i=0; i<formatList_.size(); i++) {
-    if (formatList_[i].isWriteSomething() && formatList_[i].isFileFormat())
+    if (formatList_[i].isWriteSomething() && formatList_[i].isFileFormat()) {
       indices<<i;
+    }
   }
   return indices;
 }
@@ -600,8 +616,9 @@ QList<int> MainWindow::outputDeviceFormatIndices()
 {
   QList<int>indices;
   for (int i=0; i<formatList_.size(); i++) {
-    if (formatList_[i].isWriteSomething() && formatList_[i].isDeviceFormat())
+    if (formatList_[i].isWriteSomething() && formatList_[i].isDeviceFormat()) {
       indices<<i;
+    }
   }
   return indices;
 }
@@ -611,21 +628,21 @@ void MainWindow::loadFormats()
 {
   if (!FormatLoad().getFormats(formatList_)) {
     QMessageBox::information(0, QString(appName),
-                            tr("Error reading format configuration.  "
-                               "Check that the backend program \"gpsbabel\" is properly installed "
-                               "and is in the current PATH\n\n"
-                               "This program cannot continue."));
-   exit(1);
+                             tr("Error reading format configuration.  "
+                                "Check that the backend program \"gpsbabel\" is properly installed "
+                                "and is in the current PATH\n\n"
+                                "This program cannot continue."));
+    exit(1);
   }
   if (inputFileFormatIndices().size() == 0 ||
       inputDeviceFormatIndices().size() == 0 ||
       outputFileFormatIndices().size() == 0 ||
       outputDeviceFormatIndices().size() == 0) {
     QMessageBox::information(0, QString(appName),
-                            tr("Some file/device formats were not found during initialization.  "
-                               "Check that the backend program \"gpsbabel\" is properly installed "
-                               "and is in the current PATH\n\n"
-                               "This program cannot continue."));
+                             tr("Some file/device formats were not found during initialization.  "
+                                "Check that the backend program \"gpsbabel\" is properly installed "
+                                "and is in the current PATH\n\n"
+                                "This program cannot continue."));
     exit(1);
   }
 }
@@ -636,26 +653,25 @@ static int iconIndex(bool a, bool b)
 }
 
 //------------------------------------------------------------------------
-void MainWindow::setIndicatorLights(QLabel *label, const QString &type, int code)
+void MainWindow::setIndicatorLights(QLabel* label, const QString& type, int code)
 {
   label->setPixmap(lights_[code]);
   QString s;
-  switch (code)
-    {
-    default:
-    case 0:
-      s = tr("Input and output formats do not support %1").arg(type);
-      break;
-    case 1:
-      s = tr("Input does not support %1; output format supports %1").arg(type);
-      break;
-    case 2:
-      s = tr("Input format supports %1; output format does not support %1").arg(type);
-      break;
-    case 3:
-      s = tr("Both input and output formats support %1").arg(type);
-      break;
-    }
+  switch (code) {
+  default:
+  case 0:
+    s = tr("Input and output formats do not support %1").arg(type);
+    break;
+  case 1:
+    s = tr("Input does not support %1; output format supports %1").arg(type);
+    break;
+  case 2:
+    s = tr("Input format supports %1; output format does not support %1").arg(type);
+    break;
+  case 3:
+    s = tr("Both input and output formats support %1").arg(type);
+    break;
+  }
   label->setToolTip(s);
 }
 
@@ -680,23 +696,24 @@ void MainWindow::crossCheckInOutFormats()
 }
 
 //------------------------------------------------------------------------
-void MainWindow::displayOptionsText(QLineEdit *le, QComboBox *combo, bool isInput)
+void MainWindow::displayOptionsText(QLineEdit* le, QComboBox* combo, bool isInput)
 {
   int fidx = combo->itemData(combo->currentIndex()).toInt();
-  if (isInput)
+  if (isInput) {
     le->setText(MakeOptionsNoLeadingComma(formatList_[fidx].getInputOptions()));
-  else
+  } else {
     le->setText(MakeOptionsNoLeadingComma(formatList_[fidx].getOutputOptions()));
+  }
 
 }
 
 //------------------------------------------------------------------------
-void MainWindow::setComboToFormat(QComboBox *comboBox, const QString &name, bool isFile)
+void MainWindow::setComboToFormat(QComboBox* comboBox, const QString& name, bool isFile)
 {
   int fidx = -1;
   for (int i=0; i<formatList_.size(); i++) {
     if (formatList_[i].getName() == name &&
-    formatList_[i].isFileFormat() == isFile) {
+        formatList_[i].isFileFormat() == isFile) {
       fidx = i;
       break;
     }
@@ -704,39 +721,41 @@ void MainWindow::setComboToFormat(QComboBox *comboBox, const QString &name, bool
   if (fidx >=0) {
     for (int i=0; i<comboBox->count(); i++) {
       if (comboBox->itemData(i).toInt() == fidx) {
-       comboBox->setCurrentIndex(i);
-       break;
+        comboBox->setCurrentIndex(i);
+        break;
       }
     }
   }
 }
 
 //------------------------------------------------------------------------
-bool MainWindow::formatSupportsUSB(const QString &format)
+bool MainWindow::formatSupportsUSB(const QStringformat)
 {
-    return (format == "garmin" || format == "delbin");
+  return (format == "garmin" || format == "delbin");
 }
 
 //------------------------------------------------------------------------
-bool MainWindow::formatSupportsSerial(const QString &format)
+bool MainWindow::formatSupportsSerial(const QStringformat)
 {
-    return (format != "delbin");
+  return (format != "delbin");
 }
 
 //------------------------------------------------------------------------
 void MainWindow::inputFormatChanged(int comboIdx)
 {
-  if (fmtChgInterlock_)
+  if (fmtChgInterlock_) {
     return;
+  }
   int fidx = ui_.inputFormatCombo->itemData(comboIdx).toInt();
   ui_.inputOptionsBtn->setEnabled(formatList_[fidx].getInputOptions().size()>0);
   displayOptionsText(ui_.inputOptionsText,  ui_.inputFormatCombo, true);
   crossCheckInOutFormats();
 
-  if (ui_.inputFileOptBtn->isChecked())
+  if (ui_.inputFileOptBtn->isChecked()) {
     babelData_.inputFileFormat_ =formatList_[fidx].getName();
-  else
+  } else {
     babelData_.inputDeviceFormat_ = formatList_[fidx].getName();
+  }
 
   loadInputDeviceNameCombo(formatList_[fidx].getName());
 }
@@ -744,17 +763,19 @@ void MainWindow::inputFormatChanged(int comboIdx)
 //------------------------------------------------------------------------
 void MainWindow::outputFormatChanged(int comboIdx)
 {
-  if (fmtChgInterlock_)
+  if (fmtChgInterlock_) {
     return;
+  }
   int fidx = ui_.outputFormatCombo->itemData(comboIdx).toInt();
   ui_.outputOptionsBtn->setEnabled(formatList_[fidx].getOutputOptions().size()>0);
   displayOptionsText(ui_.outputOptionsText,  ui_.outputFormatCombo, false);
   crossCheckInOutFormats();
 
-  if (ui_.outputFileOptBtn->isChecked())
+  if (ui_.outputFileOptBtn->isChecked()) {
     babelData_.outputFileFormat_ =formatList_[fidx].getName();
-  else if (ui_.outputDeviceOptBtn->isChecked())
+  } else if (ui_.outputDeviceOptBtn->isChecked()) {
     babelData_.outputDeviceFormat_ = formatList_[fidx].getName();
+  }
 
   loadOutputDeviceNameCombo(formatList_[fidx].getName());
 }
@@ -765,14 +786,13 @@ void MainWindow::inputOptionButtonClicked()
   int fidx = currentComboFormatIndex(ui_.inputFormatCombo);
   if (formatList_[fidx].getInputOptionsRef()->size() == 0) {
     QMessageBox::information
-      (0, appName,
-       tr("There are no input options for format \"%1\"").arg(formatList_[fidx].getDescription()));
-  }
-  else {
+    (0, appName,
+     tr("There are no input options for format \"%1\"").arg(formatList_[fidx].getDescription()));
+  } else {
     OptionsDlg optionDlg(0,
-             formatList_[fidx].getName(),
-             formatList_[fidx].getInputOptionsRef(),
-             formatList_[fidx].getHtml());
+                         formatList_[fidx].getName(),
+                         formatList_[fidx].getInputOptionsRef(),
+                         formatList_[fidx].getHtml());
     optionDlg.setWindowTitle(QString(appName) + " - " + tr("Options for %1").arg(formatList_[fidx].getName()));
     optionDlg.exec();
     displayOptionsText(ui_.inputOptionsText,  ui_.inputFormatCombo, true);
@@ -785,14 +805,13 @@ void MainWindow::outputOptionButtonClicked()
   int fidx = currentComboFormatIndex(ui_.outputFormatCombo);
   if (formatList_[fidx].getOutputOptionsRef()->size() == 0) {
     QMessageBox::information
-      (0, appName,
-       tr("There are no output options for format \"%1\"").arg(formatList_[fidx].getDescription()));
-  }
-  else {
-    OptionsDlg optionDlg(0, 
-             formatList_[fidx].getName(),
-             formatList_[fidx].getOutputOptionsRef(),
-             formatList_[fidx].getHtml());
+    (0, appName,
+     tr("There are no output options for format \"%1\"").arg(formatList_[fidx].getDescription()));
+  } else {
+    OptionsDlg optionDlg(0,
+                         formatList_[fidx].getName(),
+                         formatList_[fidx].getOutputOptionsRef(),
+                         formatList_[fidx].getHtml());
     optionDlg.setWindowTitle(QString(appName) + " - " + tr("Options for %1").arg(formatList_[fidx].getName()));
     optionDlg.exec();
     displayOptionsText(ui_.outputOptionsText,  ui_.outputFormatCombo, false);
@@ -805,8 +824,8 @@ void MainWindow::outputOptionButtonClicked()
 bool MainWindow::isOkToGo()
 {
   if (!((ui_.xlateWayPtsCk->isChecked() && ui_.xlateWayPtsCk->isEnabled()) ||
-    (ui_.xlateRoutesCk->isChecked() && ui_.xlateRoutesCk->isEnabled()) ||
-    (ui_.xlateTracksCk->isChecked() && ui_.xlateTracksCk->isEnabled()))) {
+        (ui_.xlateRoutesCk->isChecked() && ui_.xlateRoutesCk->isEnabled()) ||
+        (ui_.xlateTracksCk->isChecked() && ui_.xlateTracksCk->isEnabled()))) {
     QMessageBox::information(0, QString(appName), tr("No valid waypoints/routes/tracks translation specified"));
     return false;
   }
@@ -835,9 +854,8 @@ bool MainWindow::isOkToGo()
   if (babelData_.outputType_ == BabelData::noType_ && babelData_.previewGmap_ == false) {
     QMessageBox::information(0, QString(appName), tr("No valid output specified"));
     return false;
-  }
-  else if (babelData_.outputType_ == BabelData::fileType_ &&
-       babelData_.outputFileName_.length() == 0) {
+  } else if (babelData_.outputType_ == BabelData::fileType_ &&
+             babelData_.outputFileName_.length() == 0) {
     QMessageBox::information(0, QString(appName), tr("No output file specified"));
     return false;
   }
@@ -845,13 +863,13 @@ bool MainWindow::isOkToGo()
 }
 
 //------------------------------------------------------------------------
-bool MainWindow::runGpsbabel(const QStringList &args, QString &errorString,
-                         QString &outputString)
+bool MainWindow::runGpsbabel(const QStringList& args, QString& errorString,
+                             QString& outputString)
 {
-  QProcess *proc = new QProcess(0);
+  QProcessproc = new QProcess(0);
   QString name = "gpsbabel";
   proc->start(name, args);
-  ProcessWaitDialog *waitDlg = new ProcessWaitDialog(0, proc);
+  ProcessWaitDialogwaitDlg = new ProcessWaitDialog(0, proc);
 
   if (proc->state() == QProcess::NotRunning) {
     errorString = QString(tr("Process \"%1\" did not start")).arg(name);
@@ -864,16 +882,15 @@ bool MainWindow::runGpsbabel(const QStringList &args, QString &errorString,
   bool retStatus = false;
   if (waitDlg->getExitedNormally()) {
     exitCode = waitDlg->getExitCode();
-    if (exitCode == 0)
+    if (exitCode == 0) {
       retStatus = true;
-    else  {
+    else  {
       errorString =
-       QString(tr("Process exited unsucessfully with code %1"))
-       .arg(exitCode);
+        QString(tr("Process exited unsucessfully with code %1"))
+        .arg(exitCode);
       retStatus = false;
     }
-  }
-  else {
+  } else {
     retStatus = false;
     errorString = waitDlg->getErrorString();
   }
@@ -884,24 +901,25 @@ bool MainWindow::runGpsbabel(const QStringList &args, QString &errorString,
 }
 
 //------------------------------------------------------------------------
-int MainWindow::formatIndexFromName(bool isFile, const QString &nm)
+int MainWindow::formatIndexFromName(bool isFile, const QStringnm)
 {
   for (int i= 0; i<formatList_.size(); i++) {
-    if (nm == formatList_[i].getName() && formatList_[i].isFileFormat() == isFile)
+    if (nm == formatList_[i].getName() && formatList_[i].isFileFormat() == isFile) {
       return i;
+    }
   }
   return 0;
 }
 
 //------------------------------------------------------------------------
-QString MainWindow::charSetFromCombo(QComboBox *combo)
+QString MainWindow::charSetFromCombo(QComboBoxcombo)
 {
   int i = combo->itemData((combo->currentIndex())).toInt();
-  return (i >=0 ) ? charSets_[i] : QString();
+  return (i >=0) ? charSets_[i] : QString();
 }
 
 //------------------------------------------------------------------------
-void MainWindow::setComboToCharSet(QComboBox *combo, const QString &cset)
+void MainWindow::setComboToCharSet(QComboBox* combo, const QString& cset)
 {
   for (int i=0; i<charSets_.size(); i++) {
     if (charSets_[i] == cset) {
@@ -913,28 +931,36 @@ void MainWindow::setComboToCharSet(QComboBox *combo, const QString &cset)
 void MainWindow::applyActionX()
 {
   getWidgetValues();
-  if (!isOkToGo())
+  if (!isOkToGo()) {
     return;
+  }
 
   QStringList args;
 
-  if (babelData_.debugLevel_ >=0)     args << QString("-D%1").arg(babelData_.debugLevel_);
-  if (babelData_.synthShortNames_)    args << "-s";
+  if (babelData_.debugLevel_ >=0) {
+    args << QString("-D%1").arg(babelData_.debugLevel_);
+  }
+  if (babelData_.synthShortNames_) {
+    args << "-s";
+  }
 
   Format ifmt = formatList_[currentComboFormatIndex(ui_.inputFormatCombo)];
   Format ofmt = formatList_[currentComboFormatIndex(ui_.outputFormatCombo)];
 
-  if (babelData_.xlateWayPts_ && ifmt.isReadWaypoints() && ofmt.isWriteWaypoints())
+  if (babelData_.xlateWayPts_ && ifmt.isReadWaypoints() && ofmt.isWriteWaypoints()) {
     args << "-w";
-  if (babelData_.xlateRoutes_ && ifmt.isReadRoutes()    && ofmt.isWriteRoutes())
+  }
+  if (babelData_.xlateRoutes_ && ifmt.isReadRoutes()    && ofmt.isWriteRoutes()) {
     args << "-r";
-  if (babelData_.xlateTracks_ && ifmt.isReadTracks()    && ofmt.isWriteTracks())
+  }
+  if (babelData_.xlateTracks_ && ifmt.isReadTracks()    && ofmt.isWriteTracks()) {
     args << "-t";
+  }
 
   // Input type, with options
   bool iisFile = (babelData_.inputType_ == BabelData::fileType_);
   int fidx = formatIndexFromName(iisFile, iisFile ?
-                 babelData_.inputFileFormat_ : babelData_.inputDeviceFormat_);
+                                 babelData_.inputFileFormat_ : babelData_.inputDeviceFormat_);
   args << "-i";
   args << (formatList_[fidx].getName() + MakeOptions(formatList_[fidx].getInputOptions()));
 
@@ -945,8 +971,7 @@ void MainWindow::applyActionX()
       args << "-f" << babelData_.inputFileNames_[i];
       read_use_count++;
     }
-  }
-  else {
+  } else {
     args << "-f" << babelData_.inputDeviceName_;
     read_use_count++;
   }
@@ -959,16 +984,16 @@ void MainWindow::applyActionX()
   if (babelData_.outputType_ != BabelData::noType_) {
     bool outIsFile = (babelData_.outputType_ == BabelData::fileType_);
     fidx = formatIndexFromName(outIsFile, (outIsFile ?
-                       babelData_.outputFileFormat_ : babelData_.outputDeviceFormat_));
+                                           babelData_.outputFileFormat_ : babelData_.outputDeviceFormat_));
     args << "-o";
     args << (formatList_[fidx].getName() + MakeOptions(formatList_[fidx].getOutputOptions()));
 
     // output file or device option
     if (outIsFile) {
-      if (babelData_.outputFileName_ != "")
-          args << "-F" << babelData_.outputFileName_;
-    }
-    else if (babelData_.outputType_ == BabelData::deviceType_) {
+      if (babelData_.outputFileName_ != "") {
+        args << "-F" << babelData_.outputFileName_;
+      }
+    else if (babelData_.outputType_ == BabelData::deviceType_) {
       args << "-F" << babelData_.outputDeviceName_;
     }
     // GUI only ever writes a single file at a time.
@@ -1012,9 +1037,9 @@ void MainWindow::applyActionX()
       QFile(tempName).remove();
       this->show();
     }
-  }
-  else
+  } else {
     ui_.outputWindow->appendPlainText(tr("Error running gpsbabel: %1\n").arg(errorString));
+  }
 }
 
 //------------------------------------------------------------------------
@@ -1030,8 +1055,9 @@ void MainWindow::closeActionX()
   if ((babelData_.runCount_ == 1) ||
       ((babelData_.runCount_ > 5) && (babelData_.donateSplashed_.daysTo(now) > 30))) {
     Donate donate(0);
-    if (babelData_.donateSplashed_.date() == QDate(2010,1,1))
+    if (babelData_.donateSplashed_.date() == QDate(2010,1,1)) {
       donate.showNever(false);
+    }
     donate.exec();
     babelData_.donateSplashed_ = now;
   }
@@ -1060,12 +1086,12 @@ void MainWindow::visitWebsiteActionX()
 }
 
 //------------------------------------------------------------------------
-void MainWindow::dragEnterEvent(QDragEnterEvent *event)
+void MainWindow::dragEnterEvent(QDragEnterEventevent)
 {
   event->acceptProposedAction();
 }
 
-void MainWindow::dropEvent(QDropEvent *event)
+void MainWindow::dropEvent(QDropEventevent)
 {
   foreach (QString format, event->mimeData()->formats()) {
     if (format == "text/uri-list") {
@@ -1086,7 +1112,7 @@ void MainWindow::dropEvent(QDropEvent *event)
   }
 }
 //------------------------------------------------------------------------
-void MainWindow::setComboToDevice(QComboBox *comboBox, const QString &name)
+void MainWindow::setComboToDevice(QComboBox* comboBox, const QString& name)
 {
   for (int i=0; i<comboBox->count(); i++) {
     if (comboBox->itemText(i) == name) {
@@ -1103,10 +1129,12 @@ void MainWindow::saveSettings()
 
   QSettings settings;
   babelData_.saveSettings(settings);
-  for (int i=0; i<formatList_.size(); i++)
+  for (int i=0; i<formatList_.size(); i++) {
     formatList_[i].saveSettings(settings);
-  for (int i=0; i<filterData_.filters.size(); i++)
+  }
+  for (int i=0; i<filterData_.filters.size(); i++) {
     filterData_.filters[i]->saveSettings(settings);
+  }
 }
 
 //------------------------------------------------------------------------
@@ -1114,11 +1142,13 @@ void MainWindow::restoreSettings()
 {
   QSettings settings;
   babelData_.restoreSettings(settings);
-  for (int i=0; i<formatList_.size(); i++)
+  for (int i=0; i<formatList_.size(); i++) {
     formatList_[i].restoreSettings(settings);
+  }
 
-  for (int i=0; i<filterData_.filters.size(); i++)
+  for (int i=0; i<filterData_.filters.size(); i++) {
     filterData_.filters[i]->restoreSettings(settings);
+  }
 
   setWidgetValues();
 }
@@ -1127,12 +1157,13 @@ void MainWindow::restoreSettings()
 void MainWindow::resetFormatDefaults()
 {
   int ret = QMessageBox::warning
-    (this, QString(appName),
-     tr("Are you sure you want to reset all format options to default values?"),
-     QMessageBox::Yes | QMessageBox::No);
+            (this, QString(appName),
+             tr("Are you sure you want to reset all format options to default values?"),
+             QMessageBox::Yes | QMessageBox::No);
   if (ret == QMessageBox::Yes) {
-    for (int i=0; i<formatList_.size(); i++)
+    for (int i=0; i<formatList_.size(); i++) {
       formatList_[i].setToDefault();
+    }
     displayOptionsText(ui_.inputOptionsText,  ui_.inputFormatCombo, true);
     displayOptionsText(ui_.outputOptionsText,  ui_.outputFormatCombo, false);
   }
@@ -1144,7 +1175,7 @@ void MainWindow::moreOptionButtonClicked()
   AdvDlg advDlg(0, babelData_.synthShortNames_,
                 babelData_.previewGmap_, babelData_.debugLevel_);
   connect(advDlg.formatButton(), SIGNAL(clicked()),
-         this, SLOT(resetFormatDefaults()));
+          this, SLOT(resetFormatDefaults()));
   advDlg.exec();
 }
 //------------------------------------------------------------------------
@@ -1158,9 +1189,9 @@ void MainWindow::aboutActionX()
 //------------------------------------------------------------------------
 void MainWindow::upgradeCheckActionX()
 {
-    upgrade->checkForUpgrade(babelVersion_,
-                            QDateTime(QDate(2000, 1, 1), QTime(0, 0)), 
-                            allowBetaUpgrades());
+  upgrade->checkForUpgrade(babelVersion_,
+                           QDateTime(QDate(2000, 1, 1), QTime(0, 0)),
+                           allowBetaUpgrades());
 }
 
 //------------------------------------------------------------------------
@@ -1193,9 +1224,9 @@ void MainWindow::updateFilterStatus()
 {
   bool filterActive = filterData_.getAllFilterStrings().size();
   ui_.filterStatus->setEnabled(filterActive);
-  if (filterActive)
+  if (filterActive) {
     ui_.filterStatus->setToolTip(tr("One or more data filters are active"));
-  else {
+  else {
     ui_.filterStatus->setToolTip(tr("No data filters are active"));
   }
 }
@@ -1207,8 +1238,7 @@ void MainWindow::setWidgetValues()
     inputFileOptBtnClicked();
     setComboToFormat(ui_.inputFormatCombo, babelData_.inputFileFormat_, true);
     ui_.inputStackedWidget->setCurrentWidget(ui_.inputFilePage);
-  }
-  else {
+  } else {
     ui_.inputDeviceOptBtn->setChecked(true);
     inputDeviceOptBtnClicked();
     setComboToFormat(ui_.inputFormatCombo, babelData_.inputDeviceFormat_, false);
@@ -1222,15 +1252,13 @@ void MainWindow::setWidgetValues()
     outputFileOptBtnClicked();
     setComboToFormat(ui_.outputFormatCombo, babelData_.outputFileFormat_, true);
     ui_.outputStackedWidget->setCurrentWidget(ui_.outputFilePage);
-  }
-  else if (babelData_.outputType_ == BabelData::deviceType_) {
+  } else if (babelData_.outputType_ == BabelData::deviceType_) {
     ui_.outputDeviceOptBtn->setChecked(true);
     outputDeviceOptBtnClicked();
     setComboToFormat(ui_.outputFormatCombo, babelData_.outputDeviceFormat_, false);
     loadOutputDeviceNameCombo(babelData_.outputDeviceFormat_);
     ui_.outputStackedWidget->setCurrentWidget(ui_.outputDevicePage);
-  }
-  else {
+  } else {
     ui_.outputFileOptBtn->setChecked(false);
     ui_.outputDeviceOptBtn->setChecked(false);
     setComboToFormat(ui_.outputFormatCombo, babelData_.outputFileFormat_, true);
@@ -1255,11 +1283,10 @@ void MainWindow::getWidgetValues()
 {
   int comboIdx = ui_.inputFormatCombo->currentIndex();
   int fidx = ui_.inputFormatCombo->itemData(comboIdx).toInt();
-  if (ui_.inputFileOptBtn->isChecked()){
+  if (ui_.inputFileOptBtn->isChecked()) {
     babelData_.inputType_ = BabelData::fileType_;
     babelData_.inputFileFormat_ =formatList_[fidx].getName();
-  }
-  else {
+  } else {
     babelData_.inputType_ = BabelData::deviceType_;
     babelData_.inputDeviceFormat_ =formatList_[fidx].getName();
   }
@@ -1267,15 +1294,13 @@ void MainWindow::getWidgetValues()
 
   comboIdx = ui_.outputFormatCombo->currentIndex();
   fidx = ui_.outputFormatCombo->itemData(comboIdx).toInt();
-  if (ui_.outputFileOptBtn->isChecked()){
+  if (ui_.outputFileOptBtn->isChecked()) {
     babelData_.outputType_ = BabelData::fileType_;
     babelData_.outputFileFormat_ =formatList_[fidx].getName();
-  }
-  else if (ui_.outputDeviceOptBtn->isChecked()){
+  } else if (ui_.outputDeviceOptBtn->isChecked()) {
     babelData_.outputType_ = BabelData::deviceType_;
     babelData_.outputDeviceFormat_ =formatList_[fidx].getName();
-  }
-  else {
+  } else {
     babelData_.outputType_ = BabelData::noType_;
   }
   babelData_.outputDeviceName_ = ui_.outputDeviceNameCombo->currentText();
index 8924a49d79febe0f6735f603c0a498aefab1b495..88fc9cb876a8d5ebdd43aad081540a9f7db7d229 100644 (file)
 
 #include <QTranslator>
 
-class MainWindow: public QMainWindow {
+class MainWindow: public QMainWindow
+{
   Q_OBJECT
 
 
-  public:
+public:
   MainWindow(QWidget* parent);
   ~MainWindow();
 
@@ -61,39 +62,39 @@ private:
   void switchTranslator(QTranslator&, const QString&);
   void createLanguageMenu();
   QString filterForFormat(int idx);
-  QString ensureExtensionPresent(const QString &nanme, int idx);
+  QString ensureExtensionPresent(const QStringnanme, int idx);
   QString findBabelVersion();
-  bool    filterForFormatIncludes(int idx, const QString &s);
-  int  formatIndexFromName(bool isFile, const QString &);
+  bool    filterForFormatIncludes(int idx, const QStrings);
+  int  formatIndexFromName(bool isFile, const QString&);
   QList<int>inputFileFormatIndices();
   QList<int>inputDeviceFormatIndices();
   QList<int>outputFileFormatIndices();
   QList<int>outputDeviceFormatIndices();
-  int  currentComboFormatIndex(QComboBox *comboBox);
+  int  currentComboFormatIndex(QComboBoxcomboBox);
   bool isOkToGo();
-  bool runGpsbabel(const QStringList &args, QString &errorString, QString &outputString);
+  bool runGpsbabel(const QStringList& args, QString& errorString, QString& outputString);
   void crossCheckInOutFormats();
-  void setIndicatorLights(QLabel *label, const QString &type, int code) ;
-  void displayOptionsText(QLineEdit *, QComboBox *, bool);
+  void setIndicatorLights(QLabel* label, const QString& type, int code) ;
+  void displayOptionsText(QLineEdit*, QComboBox*, bool);
 
   void saveSettings();
   void restoreSettings();
-  void setComboToFormat(QComboBox *comboBox, const QString &, bool isFile);
-  void setComboToDevice(QComboBox *comboBox, const QString &);
+  void setComboToFormat(QComboBox* comboBox, const QString&, bool isFile);
+  void setComboToDevice(QComboBox* comboBox, const QString&);
 
   void loadDeviceNameCombos();
-  void loadInputDeviceNameCombo(const QString &format);
-  void loadOutputDeviceNameCombo(const QString &format);
-  bool formatSupportsUSB(const QString &format);
-  bool formatSupportsSerial(const QString &format);
+  void loadInputDeviceNameCombo(const QStringformat);
+  void loadOutputDeviceNameCombo(const QStringformat);
+  bool formatSupportsUSB(const QStringformat);
+  bool formatSupportsSerial(const QStringformat);
   void loadCharSetCombos();
   void checkCharSetCombos();
-  QString charSetFromCombo(QComboBox *);
-  void setComboToCharSet(QComboBox *, const QString &);
+  QString charSetFromCombo(QComboBox*);
+  void setComboToCharSet(QComboBox*, const QString&);
   void updateFilterStatus();
   void setWidgetValues();
   void getWidgetValues();
-  UpgradeCheck *upgrade;
+  UpgradeCheckupgrade;
   bool allowBetaUpgrades();
   void osLoadDeviceNameCombos(QComboBox*);
   QString getFormatNameForExtension(QString ext);
@@ -102,15 +103,15 @@ protected:
   void closeEvent(QCloseEvent*);
   void changeEvent(QEvent*);
 
- private slots:
+private slots:
   void aboutActionX();
   void applyActionX();
   void browseInputFile();
   void browseOutputFile();
   void closeActionX();
   void donateActionX();
-  void dragEnterEvent(QDragEnterEvent *);
-  void dropEvent(QDropEvent *event);
+  void dragEnterEvent(QDragEnterEvent*);
+  void dropEvent(QDropEventevent);
   void filtersClicked();
   void helpActionX();
   void inputDeviceOptBtnClicked();
index cb9270cd9653585be10c8f6f074d5a739ebfde75..f65af3d8b297d9c56eb35f47c41fb4f7b95adc51 100644 (file)
@@ -48,52 +48,53 @@ using std::string;
 using std::vector;
 
 //------------------------------------------------------------------------
-static QString stripDoubleQuotes(const QString s) {
+static QString stripDoubleQuotes(const QString s)
+{
   QString out;
   foreach (QChar c, s) {
-    if (c != QChar('"'))
+    if (c != QChar('"')) {
       out += c;
+    }
   }
   return out;
 }
 
 //------------------------------------------------------------------------
-Map::Map(QWidget *parent,
-        const Gpx  &gpx, QPlainTextEdit *te):
+Map::Map(QWidgetparent,
+         const Gpx&  gpx, QPlainTextEdit* te):
 #if HAVE_WEBENGINE
-    QWebEngineView(parent),
+  QWebEngineView(parent),
 #else
-    QWebView(parent),
+  QWebView(parent),
 #endif
-    gpx_(gpx),
-    mapPresent_(false),
-    busyCursor_(false),
-    textEdit_(te)
+  gpx_(gpx),
+  mapPresent_(false),
+  busyCursor_(false),
+  textEdit_(te)
 {
   busyCursor_ = true;
   stopWatch_.start();
   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
   manager_ = new QNetworkAccessManager(this);
   connect(this,SIGNAL(loadFinished(bool)),
-         this,SLOT(loadFinishedX(bool)));
+          this,SLOT(loadFinishedX(bool)));
   this->logTime("Start map constuctor");
 
 #if HAVE_WEBENGINE
-  MarkerClicker *mclicker = new MarkerClicker(this);
+  MarkerClickermclicker = new MarkerClicker(this);
   QWebChannel* channel = new QWebChannel(this->page());
   this->page()->setWebChannel(channel);
   // Note: A current limitation is that objects must be registered before any client is initialized.
   channel->registerObject(QStringLiteral("mclicker"), mclicker);
-  connect(mclicker, SIGNAL(markerClicked(int, int )), this, SLOT(markerClicked(int, int)));
-  connect(mclicker, SIGNAL(logTime(const QString &)), this, SLOT(logTime(const QString &)));
+  connect(mclicker, SIGNAL(markerClicked(int, int)), this, SLOT(markerClicked(int, int)));
+  connect(mclicker, SIGNAL(logTime(const QString&)), this, SLOT(logTime(const QString&)));
 #endif
 
   QString baseFile =  QApplication::applicationDirPath() + "/gmapbase.html";
   if (!QFile(baseFile).exists()) {
     QMessageBox::critical(0, appName,
-                         tr("Missing \"gmapbase.html\" file.  Check installation"));
-  }
-  else {
+                          tr("Missing \"gmapbase.html\" file.  Check installation"));
+  } else {
     QString urlStr = "file:///" + baseFile;
     this->load(QUrl(urlStr));
   }
@@ -110,8 +111,9 @@ Map::Map(QWidget *parent,
 //------------------------------------------------------------------------
 Map::~Map()
 {
-  if (busyCursor_)
+  if (busyCursor_) {
     QApplication::restoreOverrideCursor();
+  }
 #ifdef DEBUG_JS_GENERATION
   if (dbgout_) {
     delete dbgout_;
@@ -129,7 +131,7 @@ void Map::loadFinishedX(bool f)
   this->logTime("Done initial page load");
   if (!f)
     QMessageBox::critical(0, appName,
-                         tr("Failed to load Google maps base page"));
+                          tr("Failed to load Google maps base page"));
   else {
     QApplication::processEvents();
     showGpxData();
@@ -139,30 +141,32 @@ void Map::loadFinishedX(bool f)
 }
 
 //------------------------------------------------------------------------
-static QString fmtLatLng(const LatLng &l) {
+static QString fmtLatLng(const LatLng& l)
+{
   return  QString("{lat: %1, lng: %3}").arg(l.lat(), 0, 'f', 5) .arg(l.lng(), 0, 'f', 5);
 }
 
 //------------------------------------------------------------------------
-static QString makePath(const vector <LatLng> &pts) {
-    // maps v3 Polylines do not use encoded paths.
-    QString path;
-    int lncount = 0;
-    bool someoutput = false;
-    foreach (const LatLng ll, pts) {
-      if (lncount == 0) {
-        if (someoutput) {
-          path.append(QChar(','));
-        }
-        path.append(QLatin1String("\n            "));
-      } else if (lncount == 1) {
-        path.append(QLatin1String(", "));
+static QString makePath(const vector <LatLng>& pts)
+{
+  // maps v3 Polylines do not use encoded paths.
+  QString path;
+  int lncount = 0;
+  bool someoutput = false;
+  foreach (const LatLng ll, pts) {
+    if (lncount == 0) {
+      if (someoutput) {
+        path.append(QChar(','));
       }
-      path.append(fmtLatLng(ll));
-      someoutput = true;
-      lncount = (lncount + 1) % 2;
+      path.append(QLatin1String("\n            "));
+    } else if (lncount == 1) {
+      path.append(QLatin1String(", "));
     }
-    return path;
+    path.append(fmtLatLng(ll));
+    someoutput = true;
+    lncount = (lncount + 1) % 2;
+  }
+  return path;
 }
 
 //------------------------------------------------------------------------
@@ -171,49 +175,49 @@ void Map::showGpxData()
 
 #if !defined(HAVE_WEBENGINE)
   // Historically this was done here in showGpxData.
-  MarkerClicker *mclicker = new MarkerClicker(this);
+  MarkerClickermclicker = new MarkerClicker(this);
   this->page()->mainFrame()->addToJavaScriptWindowObject("mclicker", mclicker);
-  connect(mclicker, SIGNAL(markerClicked(int, int )), this, SLOT(markerClicked(int, int)));
-  connect(mclicker, SIGNAL(logTime(const QString &)), this, SLOT(logTime(const QString &)));
+  connect(mclicker, SIGNAL(markerClicked(int, int)), this, SLOT(markerClicked(int, int)));
+  connect(mclicker, SIGNAL(logTime(const QString&)), this, SLOT(logTime(const QString&)));
 #endif
 
   this->logTime("Start defining JS string");
   QStringList scriptStr;
   scriptStr
-    << "mclicker.logTimeX(\"Start JS execution\");"
-    << "var map = new google.maps.Map(document.getElementById(\"map\"));"
-    << "var bounds = new google.maps.LatLngBounds();"
-    << "var waypts = [];"
-    << "var rtes = [];"
-    << "var trks = [];"
-    << "var idx;"
-    << "mclicker.logTimeX(\"Done prelim JS definition\");"
-    ;
+      << "mclicker.logTimeX(\"Start JS execution\");"
+      << "var map = new google.maps.Map(document.getElementById(\"map\"));"
+      << "var bounds = new google.maps.LatLngBounds();"
+      << "var waypts = [];"
+      << "var rtes = [];"
+      << "var trks = [];"
+      << "var idx;"
+      << "mclicker.logTimeX(\"Done prelim JS definition\");"
+      ;
 
   mapPresent_ = true;
 
   // Waypoints.
   int num=0;
-  foreach (const  GpxWaypoint &pt, gpx_.getWaypoints() ) {
+  foreach (const  GpxWaypoint& pt, gpx_.getWaypoints()) {
     scriptStr
-      << QString("waypts[%1] = new google.maps.Marker({map: map, position: %2, "
-                "title: \"%3\", icon: blueIcon});")
-      .arg(num)
-      .arg(fmtLatLng(pt.getLocation()), stripDoubleQuotes(pt.getName()));
+        << QString("waypts[%1] = new google.maps.Marker({map: map, position: %2, "
+                   "title: \"%3\", icon: blueIcon});")
+        .arg(num)
+        .arg(fmtLatLng(pt.getLocation()), stripDoubleQuotes(pt.getName()));
     num++;
   }
 
   scriptStr
-    << "for (idx = 0; idx < waypts.length; idx += 1) {"
-    << "    bounds.extend(waypts[idx].getPosition());"
-    << "    attachHandler(waypts[idx], new MarkerHandler(0, idx));"
-    << "}"
-    << "mclicker.logTimeX(\"Done waypoints definition\");"
-    ;
+      << "for (idx = 0; idx < waypts.length; idx += 1) {"
+      << "    bounds.extend(waypts[idx].getPosition());"
+      << "    attachHandler(waypts[idx], new MarkerHandler(0, idx));"
+      << "}"
+      << "mclicker.logTimeX(\"Done waypoints definition\");"
+      ;
 
   // Tracks
   num = 0;
-  foreach (const GpxTrack &trk, gpx_.getTracks()) {
+  foreach (const GpxTracktrk, gpx_.getTracks()) {
     vector <LatLng> pts;
     QString path;
     foreach (const GpxTrackSegment seg, trk.getTrackSegments()) {
@@ -224,56 +228,56 @@ void Map::showGpxData()
     path = makePath(pts);
 
     scriptStr
-      << QString("trks[%1] = new RTPolyline(\n"
-                 "    map,\n"
-                 "    new google.maps.Polyline({\n        map: map,\n        strokeColor: \"#0000E0\",\n        strokeWeight: 2,\n        strokeOpacity: 0.6,\n        path: [%2\n        ]\n    }),\n"
-                 "    new google.maps.LatLng(%3),\n"
-                 "    new google.maps.LatLng(%4),\n"
-                 "    \"%5\",\n"
-                 "    new MarkerHandler(1, %1)\n);"
-                ).arg(num).arg(path, fmtLatLng(pts.front()), fmtLatLng(pts.back()), stripDoubleQuotes(trk.getName()))
-      << QString("bounds.union(trks[%1].getBounds());").arg(num)
-      ;
+        << QString("trks[%1] = new RTPolyline(\n"
+                   "    map,\n"
+                   "    new google.maps.Polyline({\n        map: map,\n        strokeColor: \"#0000E0\",\n        strokeWeight: 2,\n        strokeOpacity: 0.6,\n        path: [%2\n        ]\n    }),\n"
+                   "    new google.maps.LatLng(%3),\n"
+                   "    new google.maps.LatLng(%4),\n"
+                   "    \"%5\",\n"
+                   "    new MarkerHandler(1, %1)\n);"
+                  ).arg(num).arg(path, fmtLatLng(pts.front()), fmtLatLng(pts.back()), stripDoubleQuotes(trk.getName()))
+        << QString("bounds.union(trks[%1].getBounds());").arg(num)
+        ;
     num++;
   }
 
   scriptStr
-    << "mclicker.logTimeX(\"Done track definition\");"
-    ;
+      << "mclicker.logTimeX(\"Done track definition\");"
+      ;
 
   // Routes
   num = 0;
-  foreach (const GpxRoute &rte, gpx_.getRoutes()) {
+  foreach (const GpxRouterte, gpx_.getRoutes()) {
     vector <LatLng> pts;
     QString path;
-    foreach (const GpxRoutePoint &pt, rte.getRoutePoints()) {
+    foreach (const GpxRoutePointpt, rte.getRoutePoints()) {
       pts.push_back(pt.getLocation());
     }
     path = makePath(pts);
 
     scriptStr
-      << QString("rtes[%1] = new RTPolyline(\n"
-                 "    map,\n"
-                 "    new google.maps.Polyline({\n        map: map,\n        strokeColor: \"#8000B0\",\n        strokeWeight: 2,\n        strokeOpacity: 0.6,\n        path: [%2\n        ]\n    }),\n"
-                 "    new google.maps.LatLng(%3),\n"
-                 "    new google.maps.LatLng(%4),\n"
-                 "    \"%5\",\n"
-                 "    new MarkerHandler(2, %1)\n);"
-                ).arg(num).arg(path, fmtLatLng(pts.front()), fmtLatLng(pts.back()), stripDoubleQuotes(rte.getName()))
-      << QString("bounds.union(rtes[%1].getBounds());").arg(num)
-      ;
+        << QString("rtes[%1] = new RTPolyline(\n"
+                   "    map,\n"
+                   "    new google.maps.Polyline({\n        map: map,\n        strokeColor: \"#8000B0\",\n        strokeWeight: 2,\n        strokeOpacity: 0.6,\n        path: [%2\n        ]\n    }),\n"
+                   "    new google.maps.LatLng(%3),\n"
+                   "    new google.maps.LatLng(%4),\n"
+                   "    \"%5\",\n"
+                   "    new MarkerHandler(2, %1)\n);"
+                  ).arg(num).arg(path, fmtLatLng(pts.front()), fmtLatLng(pts.back()), stripDoubleQuotes(rte.getName()))
+        << QString("bounds.union(rtes[%1].getBounds());").arg(num)
+        ;
     num++;
   }
 
   scriptStr
-    << "mclicker.logTimeX(\"Done route definition\");"
-    ;
+      << "mclicker.logTimeX(\"Done route definition\");"
+      ;
 
   scriptStr
-    << "map.setCenter(bounds.getCenter());"
-    << "map.fitBounds(bounds);"
-    << "mclicker.logTimeX(\"Done setCenter\");"
-    ;
+      << "map.setCenter(bounds.getCenter());"
+      << "map.fitBounds(bounds);"
+      << "mclicker.logTimeX(\"Done setCenter\");"
+      ;
 
   this->logTime("Done defining JS string");
   evaluateJS(scriptStr);
@@ -281,18 +285,20 @@ void Map::showGpxData()
 }
 
 //------------------------------------------------------------------------
-void Map::markerClicked(int t, int i){
-  if (t == 0)
+void Map::markerClicked(int t, int i)
+{
+  if (t == 0) {
     emit waypointClicked(i);
-  else if (t == 1)
+  } else if (t == 1) {
     emit trackClicked(i);
-  else if (t == 2)
+  } else if (t == 2) {
     emit routeClicked(i);
+  }
 
 }
 
 //------------------------------------------------------------------------
-void Map::logTime(const QString &s)
+void Map::logTime(const QStrings)
 {
   //  fprintf(stderr, "Log: %s:  %d ms\n", s.toStdString().c_str(), stopWatch.elapsed());
   if (textEdit_) {
@@ -301,11 +307,11 @@ void Map::logTime(const QString &s)
   stopWatch_.start();
 }
 //------------------------------------------------------------------------
-void Map::showTracks(const QList<GpxTrack> &tracks)
+void Map::showTracks(const QList<GpxTrack>tracks)
 {
   QStringList scriptStr;
   int i=0;
-  foreach(const GpxTrack &trk, tracks) {
+  foreach (const GpxTrack& trk, tracks) {
     scriptStr << QString("trks[%1].%2();").arg(i).arg(trk.getVisible()?"show":"hide");
     i++;
   }
@@ -317,20 +323,20 @@ void Map::hideAllTracks()
 {
   QStringList scriptStr;
   scriptStr
-    << "for (idx = 0; idx < trks.length; idx += 1) {"
-    << "    trks[idx].hide();"
-    << "}"
-    ;
+      << "for (idx = 0; idx < trks.length; idx += 1) {"
+      << "    trks[idx].hide();"
+      << "}"
+      ;
   evaluateJS(scriptStr);
 }
 
 //------------------------------------------------------------------------
 // TACKY: we assume the waypoints list and JS waypts[] are parallel.
-void Map::showWaypoints(const QList<GpxWaypoint> &waypoints)
+void Map::showWaypoints(const QList<GpxWaypoint>waypoints)
 {
   QStringList scriptStr;
   int i=0;
-  foreach(const GpxWaypoint &pt, waypoints) {
+  foreach (const GpxWaypoint& pt, waypoints) {
     scriptStr << QString("waypts[%1].setVisible(%2);").arg(i++).arg(pt.getVisible()?"true":"false");
   }
   evaluateJS(scriptStr);
@@ -340,19 +346,19 @@ void Map::hideAllWaypoints()
 {
   QStringList scriptStr;
   scriptStr
-    << "for (idx = 0; idx < waypts.length; idx += 1) {"
-    << "    waypts[idx].setVisible(false);"
-    << "}"
-    ;
+      << "for (idx = 0; idx < waypts.length; idx += 1) {"
+      << "    waypts[idx].setVisible(false);"
+      << "}"
+      ;
   evaluateJS(scriptStr);
 }
 
 //------------------------------------------------------------------------
-void Map::showRoutes(const QList<GpxRoute> &routes)
+void Map::showRoutes(const QList<GpxRoute>routes)
 {
   QStringList scriptStr;
   int i=0;
-  foreach(const GpxRoute &rt, routes) {
+  foreach (const GpxRoute& rt, routes) {
     scriptStr << QString("rtes[%1].%2();").arg(i).arg(rt.getVisible()?"show":"hide");
     i++;
   }
@@ -363,17 +369,17 @@ void Map::hideAllRoutes()
 {
   QStringList scriptStr;
   scriptStr
-    << "for (idx = 0; idx < rtes.length; idx += 1) {"
-    << "    rtes[idx].hide();"
-    << "}"
-    ;
+      << "for (idx = 0; idx < rtes.length; idx += 1) {"
+      << "    rtes[idx].hide();"
+      << "}"
+      ;
   evaluateJS(scriptStr);
 }
 //------------------------------------------------------------------------
 void Map::setWaypointVisibility(int i, bool show)
 {
   evaluateJS(QString("waypts[%1].setVisible(%2);\n")
-            .arg(i).arg(show?"true": "false"));
+             .arg(i).arg(show?"true": "false"));
 }
 
 //------------------------------------------------------------------------
@@ -382,8 +388,8 @@ void Map::setTrackVisibility(int i, bool show)
   QString x = show?"show": "hide";
   QStringList scriptStr;
   scriptStr
-    << QString("trks[%1].%2();").arg(i).arg(x)
-    ;
+      << QString("trks[%1].%2();").arg(i).arg(x)
+      ;
   evaluateJS(scriptStr);
 }
 
@@ -393,27 +399,28 @@ void Map::setRouteVisibility(int i, bool show)
   QString x = show?"show": "hide";
   QStringList scriptStr;
   scriptStr
-    << QString("rtes[%1].%2();").arg(i).arg(x)
-    ;
+      << QString("rtes[%1].%2();").arg(i).arg(x)
+      ;
   evaluateJS(scriptStr);
 }
 
 //------------------------------------------------------------------------
-void Map::panTo(const LatLng &loc)
+void Map::panTo(const LatLngloc)
 {
   evaluateJS(QString("map.panTo(new google.maps.LatLng(%1));").arg(fmtLatLng(loc)));
 }
 
 //------------------------------------------------------------------------
-void Map::resizeEvent ( QResizeEvent * ev)
+void Map::resizeEvent(QResizeEvent* ev)
 {
 #if HAVE_WEBENGINE
   QWebEngineView::resizeEvent(ev);
 #else
   QWebView::resizeEvent(ev);
 #endif
-  if (mapPresent_)
+  if (mapPresent_) {
     evaluateJS(QString("map.checkResize();"));
+  }
 }
 
 //------------------------------------------------------------------------
@@ -434,10 +441,10 @@ void Map::frameTrack(int i)
   QStringList scriptStr;
 
   scriptStr
-    << QString("map.setCenter(trks[%1].getBounds().getCenter());").arg(i)
-    << QString("map.fitBounds(trks[%1].getBounds());").arg(i)
-    
-    ;
+      << QString("map.setCenter(trks[%1].getBounds().getCenter());").arg(i)
+      << QString("map.fitBounds(trks[%1].getBounds());").arg(i)
+
+      ;
   evaluateJS(scriptStr);
 }
 
@@ -447,15 +454,15 @@ void Map::frameRoute(int i)
 {
   QStringList scriptStr;
   scriptStr
-    << QString("map.setCenter(rtes[%1].getBounds().getCenter());").arg(i)
-    << QString("map.fitBounds(rtes[%1].getBounds());").arg(i)
-    ;
+      << QString("map.setCenter(rtes[%1].getBounds().getCenter());").arg(i)
+      << QString("map.fitBounds(rtes[%1].getBounds());").arg(i)
+      ;
   evaluateJS(scriptStr);
 }
 
 
 //------------------------------------------------------------------------
-void Map::evaluateJS(const QString &s, bool upd)
+void Map::evaluateJS(const QStrings, bool upd)
 {
 #ifdef DEBUG_JS_GENERATION
   *dbgout_ << s;
@@ -473,7 +480,7 @@ void Map::evaluateJS(const QString &s, bool upd)
 }
 
 //------------------------------------------------------------------------
-void Map::evaluateJS(const QStringList &s, bool upd)
+void Map::evaluateJS(const QStringLists, bool upd)
 {
   evaluateJS(s.join("\n"), upd);
 }
index c25653f4c27e43e300fd6f3992f5b912f8fdd931..ba3907bfd0e579b3f00d64a0a641f6e467723048 100644 (file)
--- a/gui/map.h
+++ b/gui/map.h
 class QNetworkAccessManager;
 
 
-class MarkerClicker: public QObject {
-Q_OBJECT
+class MarkerClicker: public QObject
+{
+  Q_OBJECT
 
 public:
-  MarkerClicker(QObject *parent): QObject(parent) {};
+  MarkerClicker(QObjectparent): QObject(parent) {};
 
 public slots:
-  void clickedX(int t, int i) {
+  void clickedX(int t, int i)
+  {
     emit markerClicked(t, i);
   }
-  void logTimeX(const QString &s) {
+  void logTimeX(const QString& s)
+  {
     emit logTime(s);
   }
 
 signals:
   void markerClicked(int t, int i);
-  void logTime(const QString &s);
+  void logTime(const QStrings);
 };
 
 
@@ -66,60 +69,60 @@ class Map : public QWebView
 #endif
 {
   Q_OBJECT
-    public:
-  Map(QWidget *parent, 
-      const Gpx  &gpx_, QPlainTextEdit *textEdit_);
+public:
+  Map(QWidget* parent,
+      const Gpx&  gpx_, QPlainTextEdit* textEdit_);
   ~Map();
 
-  public slots:
+public slots:
   void showGpxData();
 
-  void showTracks(const QList<GpxTrack> &tracks);
+  void showTracks(const QList<GpxTrack>tracks);
   void hideAllTracks();
   void setTrackVisibility(int i, bool show);
 
-  void showWaypoints(const QList<GpxWaypoint> &waypoints);
+  void showWaypoints(const QList<GpxWaypoint>waypoints);
   void hideAllWaypoints();
   void setWaypointVisibility(int i, bool show);
 
-  void showRoutes(const QList<GpxRoute> &routes);
+  void showRoutes(const QList<GpxRoute>routes);
   void hideAllRoutes();
   void setRouteVisibility(int i, bool show);
 
   void loadFinishedX(bool);
   void markerClicked(int t, int i);
-  void panTo(const LatLng &loc);
+  void panTo(const LatLngloc);
   void setWaypointColorRed(int i);
   void setWaypointColorBlue(int i);
   void frameTrack(int i);
   void frameRoute(int i);
 
-  void logTime(const QString &);
-  
- signals:
+  void logTime(const QString&);
+
+signals:
   void waypointClicked(int i);
   void trackClicked(int i);
   void routeClicked(int i);
-  
- private:
+
+private:
 #ifdef DEBUG_JS_GENERATION
-  QFile *dbgdata_;
-  QTextStream *dbgout_;
+  QFiledbgdata_;
+  QTextStreamdbgout_;
 #endif
-  QNetworkAccessManager *manager_;
-  const Gpx &gpx_;
+  QNetworkAccessManagermanager_;
+  const Gpxgpx_;
   bool mapPresent_;
   bool busyCursor_;
   QTime stopWatch_;
-  QPlainTextEdit *textEdit_;
+  QPlainTextEdit* textEdit_;
+
+  void evaluateJS(const QString& s, bool update = true);
+  void evaluateJS(const QStringList& s, bool update = true);
 
-  void evaluateJS(const QString &s, bool update = true);
-  void evaluateJS(const QStringList &s, bool update = true);
-  
 
 protected:
-  virtual void resizeEvent ( QResizeEvent * event );
-  
+  virtual void resizeEvent(QResizeEvent* event);
+
 };
 
 
index efe091af3f0b649383c6983be5f2751d38c013f0..8e9496d12eae6debd41f24f21b99a5a6fb63fff2 100644 (file)
 
 #include "format.h"
 
-class FileDlgManager: public QObject 
+class FileDlgManager: public QObject
 {
-Q_OBJECT
+  Q_OBJECT
 public:
-  FileDlgManager(QObject*parent, 
-                QLineEdit *le,
-                QToolButton *tb, bool isInFile);
-  
+  FileDlgManager(QObject* parent,
+                 QLineEdit* le,
+                 QToolButton* tb, bool isInFile);
+
   ~FileDlgManager();
 
 private:
-  QLineEdit *le;
-  QToolButton *tb;
+  QLineEditle;
+  QToolButtontb;
   bool isInFile;
-                  
+
 private slots:
   void buttonClicked();
 
 };
 
-class OptionsDlg: public QDialog {
-Q_OBJECT
- public:
-  OptionsDlg(QWidget *parent, const QString &fmtName_, QList<FormatOption> *options_,
-       const QString &html_);
-  
- private:
+class OptionsDlg: public QDialog
+{
+  Q_OBJECT
+public:
+  OptionsDlg(QWidget* parent, const QString& fmtName_, QList<FormatOption>* options_,
+             const QString& html_);
+
+private:
   QString fmtName_;
-  QList<FormatOption> &options_;
-  QDialogButtonBox *buttonBox_;
+  QList<FormatOption>options_;
+  QDialogButtonBoxbuttonBox_;
   QList<QCheckBox*> checkBoxes_;
   QList<QWidget*> fields_;
   QString html_;
 
- private slots:
+private slots:
   void acceptClicked();
   void rejectClicked();
   void helpClicked();
-  
+
 };
 
 
index 44aae5b7eaf3d840a3d3294b4ab32817ba22916c..d107053e546ed94d9dd87e40bc81ca3345e27109 100644 (file)
 #include "preferences.h"
 #include "../gbversion.h"
 
-class FormatListEntry : public QListWidgetItem {
- public:
-  FormatListEntry(Format& fmt) /*: fmt_(fmt)*/  {
+class FormatListEntry : public QListWidgetItem
+{
+public:
+  FormatListEntry(Format& fmt) /*: fmt_(fmt)*/
+  {
     setText(fmt.getDescription());
     bool enabled = !fmt.isHidden();
     setCheckState(enabled ? Qt::Checked : Qt::Unchecked);
   }
 
- private:
-   //Format& fmt_;
+private:
+  //Format& fmt_;
 };
 
 Preferences::Preferences(QWidget* parent, QList<Format>& formatList,
@@ -43,17 +45,18 @@ Preferences::Preferences(QWidget* parent, QList<Format>& formatList,
   ui_.reportStatisticsCheck->setChecked(babelData_.reportStatistics_);
   ui_.ignoreVersionMismatchCheck->setChecked(babelData_.ignoreVersionMismatch_);
   // Because of an unfortunate bug in 1.4.0, we turn this off in 1.4.1.
-  if (VERSION == QString("1.4.1"))
+  if (VERSION == QString("1.4.1")) {
     babelData_.ignoreVersionMismatch_ = false;
+  }
 
-  connect (ui_.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
-  connect (ui_.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked()));
+  connect(ui_.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
+  connect(ui_.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked()));
 
-  connect (ui_.enableAllButton, SIGNAL(clicked()), this, SLOT(enableAllClicked()));
-  connect (ui_.disableAllButton, SIGNAL(clicked()), this, SLOT(disableAllClicked()));
+  connect(ui_.enableAllButton, SIGNAL(clicked()), this, SLOT(enableAllClicked()));
+  connect(ui_.disableAllButton, SIGNAL(clicked()), this, SLOT(disableAllClicked()));
 
   for (int i = 0; i < formatList_.size(); i++) {
-    FormatListEntry *item = new FormatListEntry(formatList[i]);
+    FormatListEntryitem = new FormatListEntry(formatList[i]);
 
     ui_.enabledFormatsList->addItem(item);
   }
index 9ad52d911b1085cbe5ba2b3ac9deacdd94df723f..8df518652e54e8d4a5e37dfda2671f423b2fbad1 100644 (file)
 #include "babeldata.h"
 #include "format.h"
 
-class Preferences : public QDialog {
+class Preferences : public QDialog
+{
   Q_OBJECT
 
- public:
+public:
   Preferences(QWidget* parent, QList<Format>& formatList, BabelData& bd);
 
- private:
+private:
   QList<Format>& formatList_;
   Ui_Preferences ui_;
   BabelData& babelData_;
 
- private slots:
+private slots:
   void enableAllClicked();
   void disableAllClicked();
   void acceptClicked();
index 6160b73a86746be70ebaaae07e835f48072690ab..b93ad8eee068daae19eda6d731a8079fcea1a3d3 100644 (file)
 
 //------------------------------------------------------------------------
 
-QString ProcessWaitDialog::processErrorString( QProcess::ProcessError err)
+QString ProcessWaitDialog::processErrorString(QProcess::ProcessError err)
 {
-  switch (err)
-    {
-    case QProcess::FailedToStart:
-      return QString(tr("Process failed to start"));
-      break;
-    case QProcess::Crashed:
-      return QString(tr("Process crashed"));
-      break;
-    case QProcess::Timedout:
-      return QString(tr("Process timedout"));
-      break;
-    case QProcess::WriteError:
-      return QString(tr("Error while trying to write to process"));
-      break;
-    case QProcess::ReadError:
-      return QString(tr("Error while trying to read from process"));
-      break;
-    case QProcess::UnknownError:
-    default:
-      return QString(tr("Unknown process error"));
-    }
+  switch (err) {
+  case QProcess::FailedToStart:
+    return QString(tr("Process failed to start"));
+    break;
+  case QProcess::Crashed:
+    return QString(tr("Process crashed"));
+    break;
+  case QProcess::Timedout:
+    return QString(tr("Process timedout"));
+    break;
+  case QProcess::WriteError:
+    return QString(tr("Error while trying to write to process"));
+    break;
+  case QProcess::ReadError:
+    return QString(tr("Error while trying to read from process"));
+    break;
+  case QProcess::UnknownError:
+  default:
+    return QString(tr("Unknown process error"));
+  }
   return QString("");
 }
 //------------------------------------------------------------------------
-ProcessWaitDialog::ProcessWaitDialog(QWidget *parent, QProcess *process):
+ProcessWaitDialog::ProcessWaitDialog(QWidget* parent, QProcess* process):
   QDialog(parent), process_(process)
 {
   this->resize(400, 220);
   this->setWindowTitle(QString(appName) + tr(" ... Process GPSBabel"));
-  QVBoxLayout *layout = new QVBoxLayout(this);
+  QVBoxLayoutlayout = new QVBoxLayout(this);
 
   textEdit_ = new QPlainTextEdit(this);
   textEdit_->setReadOnly(true);
@@ -84,24 +83,26 @@ ProcessWaitDialog::ProcessWaitDialog(QWidget *parent, QProcess *process):
   layout->addWidget(buttonBox_);
 
   connect(process, SIGNAL(error(QProcess::ProcessError)),
-         this,    SLOT  (errorX(QProcess::ProcessError)));
+          this,    SLOT(errorX(QProcess::ProcessError)));
   connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
-         this,    SLOT  (finishedX(int, QProcess::ExitStatus)));
+          this,    SLOT(finishedX(int, QProcess::ExitStatus)));
   connect(process, SIGNAL(readyReadStandardError()),
-          this,    SLOT  (readyReadStandardErrorX()));
+          this,    SLOT(readyReadStandardErrorX()));
   connect(process, SIGNAL(readyReadStandardOutput()),
-         this,    SLOT  (readyReadStandardOutputX()));
+          this,    SLOT(readyReadStandardOutputX()));
   connect(btn,     SIGNAL(clicked()),
-         this,    SLOT  (stopClickedX()));
+          this,    SLOT(stopClickedX()));
   exitStatus_ = QProcess::CrashExit;  // Assume all errors are crashes for now.
 
   bufferedOut_ = "";
 
   //
-  for (int i=0; i<=100; i+=2)
+  for (int i=0; i<=100; i+=2) {
     progressVals_.push_back(i);
-  for (int i=98; i>0; i-=2)
+  }
+  for (int i=98; i>0; i-=2) {
     progressVals_.push_back(i);
+  }
   progressIndex_ = progressVals_.size()/2;
 
   timer_ = new QTimer(this);
@@ -148,8 +149,9 @@ void ProcessWaitDialog::timeoutX()
   progressIndex_++;
   int idx = progressIndex_ % progressVals_.size();
   progressBar_->setValue(progressVals_[idx]);
-  if (stopCount_ >=0)
+  if (stopCount_ >=0) {
     stopCount_++;
+  }
   if (stopCount_ > 150) {
     process_->kill();
     errorString_ = QString(tr("Process did not terminate successfully"));
@@ -170,8 +172,9 @@ void ProcessWaitDialog::errorX(QProcess::ProcessError err)
 void ProcessWaitDialog::finishedX(int exitCode, QProcess::ExitStatus es)
 {
   ecode_ = exitCode;
-  if (es == QProcess::CrashExit)
+  if (es == QProcess::CrashExit) {
     errorString_ = QString(tr("Process crashed whle running"));
+  }
   timer_->stop();
   accept();
 };
@@ -181,12 +184,13 @@ void ProcessWaitDialog::finishedX(int exitCode, QProcess::ExitStatus es)
 // appendPlainText automatically puts in a new line with every call.  That's
 // why you have to buffer it, and only append when we get a real newline.
 //
-void ProcessWaitDialog::appendToText(const char *ptr)
+void ProcessWaitDialog::appendToText(const charptr)
 {
   outputString_ += QString(ptr);
-  for (const char *cptr = ptr; *cptr; cptr++) {
-    if (*cptr == '\r')
+  for (const charcptr = ptr; *cptr; cptr++) {
+    if (*cptr == '\r') {
       continue;
+    }
     if (*cptr == '\n') {
       textEdit_->appendPlainText(QString::fromStdString(bufferedOut_));
       bufferedOut_ = "";
@@ -206,12 +210,12 @@ void ProcessWaitDialog::readyReadStandardErrorX()
 
 //------------------------------------------------------------------------
 void ProcessWaitDialog::readyReadStandardOutputX()
- {
+{
   QByteArray d = process_->readAllStandardOutput();
   appendToText(d.data());
 };
 
-void ProcessWaitDialog::closeEvent(QCloseEvent *event)
+void ProcessWaitDialog::closeEvent(QCloseEventevent)
 {
-   event->ignore();
+  event->ignore();
 };
index a04e8f56bb75d9bf4565e64ca5ec31f8587a1f76..a3ffe2de99a6d5a9d606be4c2da1762ab00bd870 100644 (file)
@@ -36,28 +36,31 @@ class QPlainTextEdit;
 class QDialogButtonBox;
 class QTimer;
 //------------------------------------------------------------------------
-class ProcessWaitDialog: public QDialog 
+class ProcessWaitDialog: public QDialog
 {
-  
+
   Q_OBJECT
-  
- public:
+
+public:
   //
-  ProcessWaitDialog(QWidget *parent, QProcess *process_);
+  ProcessWaitDialog(QWidget* parent, QProcess* process_);
   ~ProcessWaitDialog();
-  
+
   bool getExitedNormally();
   int getExitCode();
   QString getErrorString();
-  QString getOutputString() const {return outputString_;};
+  QString getOutputString() const
+  {
+    return outputString_;
+  };
 
- protected:
-  void closeEvent (QCloseEvent*event);
-  void appendToText(const char *);
+protected:
+  void closeEvent(QCloseEvent* event);
+  void appendToText(const char*);
   QString processErrorString(QProcess::ProcessError err);
-                                
 
- private slots:
+
+private slots:
   void errorX(QProcess::ProcessError);
   void finishedX(int exitCode, QProcess::ExitStatus);
   void readyReadStandardErrorX();
@@ -65,18 +68,18 @@ class ProcessWaitDialog: public QDialog
   void timeoutX();
   void stopClickedX();
 
- private:
+private:
   vector <int> progressVals_;
   int          progressIndex_;
   int          stopCount_;
   string       bufferedOut_;
   QProcess::ExitStatus exitStatus_;
   int                  ecode_;
-  QProcess     *process_;
-  QProgressBar *progressBar_;
-  QPlainTextEdit *textEdit_;
-  QDialogButtonBox *buttonBox_;
-  QTimer           *timer_;
+  QProcess*     process_;
+  QProgressBarprogressBar_;
+  QPlainTextEdittextEdit_;
+  QDialogButtonBoxbuttonBox_;
+  QTimer*           timer_;
   QString          errorString_;
   QString          outputString_;
 };
index fc78d9ccd3bc0222dec897f0ccfbf043686072dc..e5055ad7ecd0de1fe7f75cb002298cdf63d503f9 100644 (file)
@@ -5,7 +5,7 @@
 // Apple's copyright blob:
 /*
     Copyright:         Â© Copyright 2000-2005 Apple Computer, Inc. All rights reserved.
-       
+
     Disclaimer:                IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
                                        ("Apple") in consideration of your agreement to the following terms, and your
                                        use, installation, modification or redistribution of this Apple software
@@ -40,7 +40,7 @@
                                        OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
                                        (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
                                        ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-                               
+
 */
 
 #include <stdio.h>
 #include "mainwindow.h"
 
 // Function prototypes
-static kern_return_t FindModems(io_iterator_t *matchingServices);
+static kern_return_t FindModems(io_iterator_tmatchingServices);
 // static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char *bsdPath, CFIndex maxPathSize);
 // static int OpenSerialPort(const char *bsdPath);
 
 // Returns an iterator across all known modems. Caller is responsible for
 // releasing the iterator when iteration is complete.
-static kern_return_t FindModems(io_iterator_t *matchingServices)
+static kern_return_t FindModems(io_iterator_tmatchingServices)
 {
-    kern_return_t                      kernResult;
-    CFMutableDictionaryRef     classesToMatch;
-
-/*! @function IOServiceMatching
-    @abstract Create a matching dictionary that specifies an IOService class match.
-    @discussion A very common matching criteria for IOService is based on its class. IOServiceMatching will create a matching dictionary that specifies any IOService of a class, or its subclasses. The class is specified by C-string name.
-    @param name The class name, as a const C-string. Class matching is successful on IOService's of this class or any subclass.
-    @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
-
-    // Serial devices are instances of class IOSerialBSDClient
-    classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
-    if (classesToMatch == NULL)
-    {
-        printf("IOServiceMatching returned a NULL dictionary.\n");
-    }
-    else {
-/*!
-       @function CFDictionarySetValue
-       Sets the value of the key in the dictionary.
-       @param theDict The dictionary to which the value is to be set. If this
-               parameter is not a valid mutable CFDictionary, the behavior is
-               undefined. If the dictionary is a fixed-capacity dictionary and
-               it is full before this operation, and the key does not exist in
-               the dictionary, the behavior is undefined.
-       @param key The key of the value to set into the dictionary. If a key
-               which matches this key is already present in the dictionary, only
-               the value is changed ("add if absent, replace if present"). If
-               no key matches the given key, the key-value pair is added to the
-               dictionary. If added, the key is retained by the dictionary,
-               using the retain callback provided
-               when the dictionary was created. If the key is not of the sort
-               expected by the key retain callback, the behavior is undefined.
-       @param value The value to add to or replace into the dictionary. The value
-               is retained by the dictionary using the retain callback provided
-               when the dictionary was created, and the previous value if any is
-               released. If the value is not of the sort expected by the
-               retain or release callbacks, the behavior is undefined.
-*/
+  kern_return_t                        kernResult;
+  CFMutableDictionaryRef       classesToMatch;
+
+  /*! @function IOServiceMatching
+      @abstract Create a matching dictionary that specifies an IOService class match.
+      @discussion A very common matching criteria for IOService is based on its class. IOServiceMatching will create a matching dictionary that specifies any IOService of a class, or its subclasses. The class is specified by C-string name.
+      @param name The class name, as a const C-string. Class matching is successful on IOService's of this class or any subclass.
+      @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+  // Serial devices are instances of class IOSerialBSDClient
+  classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
+  if (classesToMatch == NULL) {
+    printf("IOServiceMatching returned a NULL dictionary.\n");
+  } else {
+    /*!
+       @function CFDictionarySetValue
+       Sets the value of the key in the dictionary.
+       @param theDict The dictionary to which the value is to be set. If this
+               parameter is not a valid mutable CFDictionary, the behavior is
+               undefined. If the dictionary is a fixed-capacity dictionary and
+               it is full before this operation, and the key does not exist in
+               the dictionary, the behavior is undefined.
+       @param key The key of the value to set into the dictionary. If a key
+               which matches this key is already present in the dictionary, only
+               the value is changed ("add if absent, replace if present"). If
+               no key matches the given key, the key-value pair is added to the
+               dictionary. If added, the key is retained by the dictionary,
+               using the retain callback provided
+               when the dictionary was created. If the key is not of the sort
+               expected by the key retain callback, the behavior is undefined.
+       @param value The value to add to or replace into the dictionary. The value
+               is retained by the dictionary using the retain callback provided
+               when the dictionary was created, and the previous value if any is
+               released. If the value is not of the sort expected by the
+               retain or release callbacks, the behavior is undefined.
+    */
 //        CFDictionarySetValue(classesToMatch,
 //                             CFSTR(kIOSerialBSDTypeKey),
 //                             CFSTR(kIOSerialBSDModemType));
 
-               // Each serial device object has a property with key
-        // kIOSerialBSDTypeKey and a value that is one of kIOSerialBSDAllTypes,
-        // kIOSerialBSDModemType, or kIOSerialBSDRS232Type. You can experiment with the
-        // matching by changing the last parameter in the above call to CFDictionarySetValue.
-
-        // As shipped, this sample is only interested in modems,
-        // so add this property to the CFDictionary we're matching on.
-        // This will find devices that advertise themselves as modems,
-        // such as built-in and USB modems. However, this match won't find serial modems.
-    }
-
-    /*! @function IOServiceGetMatchingServices
-        @abstract Look up registered IOService objects that match a matching dictionary.
-        @discussion This is the preferred method of finding IOService objects currently registered by IOKit. IOServiceAddNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
-        @param masterPort The master port obtained from IOMasterPort().
-        @param matching A CF dictionary containing matching information, of which one reference is consumed by this function. IOKitLib can contruct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOOpenFirmwarePathMatching.
-        @param existing An iterator handle is returned on success, and should be released by the caller when the iteration is finished.
-        @result A kern_return_t error code. */
-
-    kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, classesToMatch, matchingServices);
-    if (KERN_SUCCESS != kernResult)
-    {
-        printf("IOServiceGetMatchingServices returned %d\n", kernResult);
-               goto exit;
-    }
+    // Each serial device object has a property with key
+    // kIOSerialBSDTypeKey and a value that is one of kIOSerialBSDAllTypes,
+    // kIOSerialBSDModemType, or kIOSerialBSDRS232Type. You can experiment with the
+    // matching by changing the last parameter in the above call to CFDictionarySetValue.
+
+    // As shipped, this sample is only interested in modems,
+    // so add this property to the CFDictionary we're matching on.
+    // This will find devices that advertise themselves as modems,
+    // such as built-in and USB modems. However, this match won't find serial modems.
+  }
+
+  /*! @function IOServiceGetMatchingServices
+      @abstract Look up registered IOService objects that match a matching dictionary.
+      @discussion This is the preferred method of finding IOService objects currently registered by IOKit. IOServiceAddNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
+      @param masterPort The master port obtained from IOMasterPort().
+      @param matching A CF dictionary containing matching information, of which one reference is consumed by this function. IOKitLib can contruct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOOpenFirmwarePathMatching.
+      @param existing An iterator handle is returned on success, and should be released by the caller when the iteration is finished.
+      @result A kern_return_t error code. */
+
+  kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, classesToMatch, matchingServices);
+  if (KERN_SUCCESS != kernResult) {
+    printf("IOServiceGetMatchingServices returned %d\n", kernResult);
+    goto exit;
+  }
 
 exit:
-    return kernResult;
+  return kernResult;
 }
 
 // Given an iterator across a set of modems, return the BSD path to the first one.
 // If no modems are found the path name is set to an empty string.
-static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char *bsdPath, CFIndex maxPathSize, QComboBox *box)
+static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char* bsdPath, CFIndex maxPathSize, QComboBox* box)
 {
-    io_object_t                modemService;
-    kern_return_t      kernResult = KERN_FAILURE;
-    Boolean                    modemFound = false;
-
-    // Initialize the returned path
-    *bsdPath = '\0';
-
-    // Iterate across all modems found. In this example, we bail after finding the first modem.
-
-    while ((modemService = IOIteratorNext(serialPortIterator)) && !modemFound)
-    {
-        CFTypeRef      bsdPathAsCFString;
-
-               // Get the callout device's path (/dev/cu.xxxxx). The callout device should almost always be
-               // used: the dialin device (/dev/tty.xxxxx) would be used when monitoring a serial port for
-               // incoming calls, e.g. a fax listener.
-       
-               bsdPathAsCFString = IORegistryEntryCreateCFProperty(modemService,
-                                                            CFSTR(kIOCalloutDeviceKey),
-                                                            kCFAllocatorDefault,
-                                                            0);
-        if (bsdPathAsCFString)
-        {
-            Boolean result;
-
-            // Convert the path from a CFString to a C (NUL-terminated) string for use
-                       // with the POSIX open() call.
-       
-                       result = CFStringGetCString((const __CFString*) bsdPathAsCFString,
-                                        bsdPath,
-                                        maxPathSize,
-                                        kCFStringEncodingUTF8);
-            CFRelease(bsdPathAsCFString);
-
-            if (result) {
-                   box->addItem(bsdPath);
-            }
-        }
-
-        // Release the io_service_t now that we are done with it.
-       
-//             (void) IOObjectRelease(modemService);
+  io_object_t          modemService;
+  kern_return_t        kernResult = KERN_FAILURE;
+  Boolean                      modemFound = false;
+
+  // Initialize the returned path
+  *bsdPath = '\0';
+
+  // Iterate across all modems found. In this example, we bail after finding the first modem.
+
+  while ((modemService = IOIteratorNext(serialPortIterator)) && !modemFound) {
+    CFTypeRef  bsdPathAsCFString;
+
+    // Get the callout device's path (/dev/cu.xxxxx). The callout device should almost always be
+    // used: the dialin device (/dev/tty.xxxxx) would be used when monitoring a serial port for
+    // incoming calls, e.g. a fax listener.
+
+    bsdPathAsCFString = IORegistryEntryCreateCFProperty(modemService,
+                        CFSTR(kIOCalloutDeviceKey),
+                        kCFAllocatorDefault,
+                        0);
+    if (bsdPathAsCFString) {
+      Boolean result;
+
+      // Convert the path from a CFString to a C (NUL-terminated) string for use
+      // with the POSIX open() call.
+
+      result = CFStringGetCString((const __CFString*) bsdPathAsCFString,
+                                  bsdPath,
+                                  maxPathSize,
+                                  kCFStringEncodingUTF8);
+      CFRelease(bsdPathAsCFString);
+
+      if (result) {
+        box->addItem(bsdPath);
+      }
     }
 
-    return kernResult;
+    // Release the io_service_t now that we are done with it.
+
+//             (void) IOObjectRelease(modemService);
+  }
+
+  return kernResult;
 }
 
 #include "mainwindow.h"
-void MainWindow::osLoadDeviceNameCombos(QComboBox *box)
+void MainWindow::osLoadDeviceNameCombos(QComboBoxbox)
 {
   kern_return_t       kernResult;
   io_iterator_t       serialPortIterator;
index f2995be467cdbbe5eb75123229742993c3b37ed7..7e4d421e72c12bc4656d36436f77355487fdafa0 100644 (file)
 
 static QStringList dynamicDevices()
 {
-    struct udev *udev = udev_new();
-    if(!udev) {
-        qDebug() << "Can't create udev";
-        return QStringList();
-    }
+  struct udev* udev = udev_new();
+  if (!udev) {
+    qDebug() << "Can't create udev";
+    return QStringList();
+  }
 
-    QSet<QString> devices;
+  QSet<QString> devices;
 
-    struct udev_enumerate *enumerate = udev_enumerate_new(udev);
-    udev_enumerate_add_match_subsystem(enumerate, "tty");
-    udev_enumerate_scan_devices(enumerate);
+  struct udev_enumerate* enumerate = udev_enumerate_new(udev);
+  udev_enumerate_add_match_subsystem(enumerate, "tty");
+  udev_enumerate_scan_devices(enumerate);
 
-    struct udev_list_entry *device;
-    udev_list_entry_foreach(device, udev_enumerate_get_list_entry(enumerate)) {
-        const char *path = udev_list_entry_get_name(device);
-        struct udev_device *dev = udev_device_new_from_syspath(udev, path);
+  struct udev_list_entry* device;
+  udev_list_entry_foreach(device, udev_enumerate_get_list_entry(enumerate)) {
+    const char* path = udev_list_entry_get_name(device);
+    struct udev_device* dev = udev_device_new_from_syspath(udev, path);
 
-        bool okMaj, okMin;
-        int major = QString(udev_device_get_property_value(dev, "MAJOR")).toInt(&okMaj);
-        int minor = QString(udev_device_get_property_value(dev, "MINOR")).toInt(&okMin);
-        if(!okMaj || !okMin) {
-             major = -1;
-             minor = -1;
-        }
+    bool okMaj, okMin;
+    int major = QString(udev_device_get_property_value(dev, "MAJOR")).toInt(&okMaj);
+    int minor = QString(udev_device_get_property_value(dev, "MINOR")).toInt(&okMin);
+    if (!okMaj || !okMin) {
+      major = -1;
+      minor = -1;
+    }
 
-        // see Documentation/devices.txt in the linux tree
-        if( !( (major == 4 || major == 5) && 0 <= minor && minor <= 63 ) ) {
-            devices << QString::fromUtf8(udev_device_get_devnode(dev));
-            /*
-            udev_device_get_sysattr_list_entry(dev);
-            udev_device_get_tags_list_entry(dev);
-            struct udev_list_entry *prop;
-            qDebug() << "Device Node Path:" << udev_device_get_devnode(dev) << path;
-            udev_list_entry_foreach(prop, udev_device_get_properties_list_entry(dev)) {
-                qDebug() << "  " << udev_list_entry_get_name(prop)
-                         << "=>" << udev_list_entry_get_value(prop);
-            }
-            */
-        }
-        udev_device_unref(dev);
+    // see Documentation/devices.txt in the linux tree
+    if (!((major == 4 || major == 5) && 0 <= minor && minor <= 63)) {
+      devices << QString::fromUtf8(udev_device_get_devnode(dev));
+      /*
+      udev_device_get_sysattr_list_entry(dev);
+      udev_device_get_tags_list_entry(dev);
+      struct udev_list_entry *prop;
+      qDebug() << "Device Node Path:" << udev_device_get_devnode(dev) << path;
+      udev_list_entry_foreach(prop, udev_device_get_properties_list_entry(dev)) {
+          qDebug() << "  " << udev_list_entry_get_name(prop)
+                   << "=>" << udev_list_entry_get_value(prop);
+      }
+      */
     }
-    udev_enumerate_unref(enumerate);
-    udev_unref(udev);
+    udev_device_unref(dev);
+  }
+  udev_enumerate_unref(enumerate);
+  udev_unref(udev);
 
-    QStringList list = devices.toList();
-    qSort(list);
-    return list;
+  QStringList list = devices.toList();
+  qSort(list);
+  return list;
 }
 #else
 static QStringList dynamicDevices()
 {
-    return QStringList();
+  return QStringList();
 }
 #endif
 
 
-static const char *deviceNames[] = {
+static const chardeviceNames[] = {
   "/dev/ttyS0",
   "/dev/ttyS1",
   "/dev/ttyS2",
@@ -93,13 +93,13 @@ static const char *deviceNames[] = {
   0
 };
 
-void MainWindow::osLoadDeviceNameCombos(QComboBox *box)
+void MainWindow::osLoadDeviceNameCombos(QComboBoxbox)
 {
   const QStringList devices = dynamicDevices();
   box->addItems(devices);
 
   for (int i=0; deviceNames[i]; i++) {
-    if(!devices.contains(deviceNames[i])) {
+    if (!devices.contains(deviceNames[i])) {
       box->addItem(deviceNames[i]);
     }
   }
index 1a267e68b454d671783c6b4c5cb824d698a47646..9aa33a5fb922e115f85fc8a54cc803782d71cc8d 100644 (file)
@@ -23,7 +23,7 @@
 
 #if 0  // Does not require Windows 2000
 
-static const char *deviceNames[] = {
+static const chardeviceNames[] = {
   "com1:",
   "com2:",
   "com3:",
@@ -31,7 +31,7 @@ static const char *deviceNames[] = {
   0
 };
 
-void MainWindow::osLoadDeviceNameCombos(QComboBox *box)
+void MainWindow::osLoadDeviceNameCombos(QComboBoxbox)
 {
   for (int i=0; deviceNames[i]; i++) {
     box->addItem(deviceNames[i]);
@@ -41,30 +41,30 @@ void MainWindow::osLoadDeviceNameCombos(QComboBox *box)
 #else // This code assumes Windows 2000 or later
 
 // Uses QueryDosDevice(), Minimum supported: Windows 2000 Professional/Server
-#include <windows.h> 
+#include <windows.h>
 #include <stdio.h>
 
-void MainWindow::osLoadDeviceNameCombos(QComboBox *box)
+void MainWindow::osLoadDeviceNameCombos(QComboBoxbox)
 {
   char DevList[64*1024-1];  // a single byte more, and certain versions of windows
-                            // always return QueryDosDevice()==0 && GetLastError()==ERROR_MORE_DATA.
-                            // see http://support.microsoft.com/kb/931305
+  // always return QueryDosDevice()==0 && GetLastError()==ERROR_MORE_DATA.
+  // see http://support.microsoft.com/kb/931305
   // Get a list of all existing MS-DOS device names. Stores one or more asciiz strings followed by an extra null.
   DWORD res = QueryDosDeviceA(NULL, DevList, sizeof(DevList));
-  if (res == 0)
-  {
+  if (res == 0) {
     DWORD err = GetLastError(); // could check for ERROR_INSUFFICIENT_BUFFER, and retry with a larger buffer.
-                                // but DevList is already at the maximum size it can be without running into kb 931305.
+    // but DevList is already at the maximum size it can be without running into kb 931305.
     // FIXME: This shold be a QMessageBox::warning() - RJL
     // fprintf(stderr,"QueryDosDevice() failed with %d.  GetLastError()==%d.\n", res, err);
     (void) err;
     return;
   }
 
-  for (char *p=DevList; *p;) {
+  for (charp=DevList; *p;) {
     int len = strlen(p);
-    if (strncmp(p,"COM",3)==0)
+    if (strncmp(p,"COM",3)==0) {
       box->addItem((PCHAR)p);
+    }
     p += len+1; // +1 to also skip the null character of each string
   }
 }
index 94282922ccf6fd6e2fffc3e094705146885c6f87..805fe198af5d44d8d1df131529f463a1dc2ac15d 100644 (file)
 
 
 //------------------------------------------------------------------------
-class VarSetting {
- public:
+class VarSetting
+{
+public:
   VarSetting() {};
   virtual ~VarSetting() {};
 
-  virtual void saveSetting(QSettings &) = 0;
-  virtual void restoreSetting(QSettings &) = 0;
+  virtual void saveSetting(QSettings&) = 0;
+  virtual void restoreSetting(QSettings&) = 0;
 };
 
 
 //------------------------------------------------------------------------
 class IntSetting: public VarSetting
 {
- public:
-  IntSetting(const QString &name, int &var): VarSetting(), name_(name), var_(var) { }
-  void saveSetting(QSettings &st) {st.setValue(name_, var_); }
-  void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toInt(); }
+public:
+  IntSetting(const QString& name, int& var): VarSetting(), name_(name), var_(var) { }
+  void saveSetting(QSettings& st)
+  {
+    st.setValue(name_, var_);
+  }
+  void restoreSetting(QSettings& st)
+  {
+    if (st.contains(name_)) {
+      var_ = st.value(name_).toInt();
+    }
+  }
 
- private:
+private:
   QString name_;
-  int &var_;
+  intvar_;
 };
 
 //------------------------------------------------------------------------
 class DoubleSetting: public VarSetting
 {
- public:
-  DoubleSetting(const QString &name, double &var): VarSetting(), name_(name), var_(var) { }
-  void saveSetting(QSettings &st) {st.setValue(name_, var_); }
-  void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toDouble(); }
+public:
+  DoubleSetting(const QString& name, double& var): VarSetting(), name_(name), var_(var) { }
+  void saveSetting(QSettings& st)
+  {
+    st.setValue(name_, var_);
+  }
+  void restoreSetting(QSettings& st)
+  {
+    if (st.contains(name_)) {
+      var_ = st.value(name_).toDouble();
+    }
+  }
 
- private:
+private:
   QString name_;
-  double &var_;
+  doublevar_;
 };
 
 //------------------------------------------------------------------------
 class StringSetting: public VarSetting
 {
- public:
-  StringSetting(const QString &name, QString &var): VarSetting(), name_(name), var_(var) { }
-  void saveSetting(QSettings &st) {st.setValue(name_, var_); }
-  void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toString(); }
+public:
+  StringSetting(const QString& name, QString& var): VarSetting(), name_(name), var_(var) { }
+  void saveSetting(QSettings& st)
+  {
+    st.setValue(name_, var_);
+  }
+  void restoreSetting(QSettings& st)
+  {
+    if (st.contains(name_)) {
+      var_ = st.value(name_).toString();
+    }
+  }
 
- private:
+private:
   QString name_;
-  QString &var_;
+  QStringvar_;
 };
 
 //------------------------------------------------------------------------
 class BoolSetting: public VarSetting
 {
- public:
-  BoolSetting(const QString &name, bool &var): VarSetting(), name_(name), var_(var) { }
-  void saveSetting(QSettings &st) {st.setValue(name_, var_); }
-  void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toBool(); }
+public:
+  BoolSetting(const QString& name, bool& var): VarSetting(), name_(name), var_(var) { }
+  void saveSetting(QSettings& st)
+  {
+    st.setValue(name_, var_);
+  }
+  void restoreSetting(QSettings& st)
+  {
+    if (st.contains(name_)) {
+      var_ = st.value(name_).toBool();
+    }
+  }
 
- private:
+private:
   QString name_;
-  bool &var_;
+  boolvar_;
 };
 
 //------------------------------------------------------------------------
 class DateTimeSetting: public VarSetting
 {
- public:
-  DateTimeSetting(const QString &name, QDateTime &var):VarSetting(), name_(name), var_(var) { }
-  void saveSetting(QSettings &st) {st.setValue(name_, var_); }
-  void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toDateTime(); }
+public:
+  DateTimeSetting(const QString& name, QDateTime& var):VarSetting(), name_(name), var_(var) { }
+  void saveSetting(QSettings& st)
+  {
+    st.setValue(name_, var_);
+  }
+  void restoreSetting(QSettings& st)
+  {
+    if (st.contains(name_)) {
+      var_ = st.value(name_).toDateTime();
+    }
+  }
 
- private:
+private:
   QString name_;
-  QDateTime &var_;
+  QDateTimevar_;
 };
 
 
 //------------------------------------------------------------------------
-class SettingGroup {
- public:
+class SettingGroup
+{
+public:
   SettingGroup() {}
-  ~SettingGroup() {
-    for (int i=0; i< settingGroup_.size(); i++)
+  ~SettingGroup()
+  {
+    for (int i=0; i< settingGroup_.size(); i++) {
       delete settingGroup_[i];
+    }
   }
 
-  void saveSettings(QSettings &st) {
-    for (int i=0; i< settingGroup_.size(); i++)
+  void saveSettings(QSettings& st)
+  {
+    for (int i=0; i< settingGroup_.size(); i++) {
       settingGroup_[i]->saveSetting(st);
+    }
   }
-  void restoreSettings(QSettings &st) {
-    for (int i=0; i< settingGroup_.size(); i++)
+  void restoreSettings(QSettings& st)
+  {
+    for (int i=0; i< settingGroup_.size(); i++) {
       settingGroup_[i]->restoreSetting(st);
+    }
   }
 
-  void addVarSetting(VarSetting *vs) {
+  void addVarSetting(VarSetting* vs)
+  {
     settingGroup_ << vs;
   }
 
- private:
-  QList <VarSetting *> settingGroup_;
+private:
+  QList <VarSetting*> settingGroup_;
 };
 
 #endif
index 0e82d8a47c2d0df231de8c6f285f05d3656b302b..79444e790e19a5261f50d6e53aeaf0fc897f8ab4 100644 (file)
@@ -46,7 +46,7 @@ static const bool testing = true;
 static const bool testing = false;
 #endif
 
-UpgradeCheck::UpgradeCheck(QWidget *parent, QList<Format> &formatList,
+UpgradeCheck::UpgradeCheck(QWidget* parent, QList<Format>& formatList,
                            BabelData& bd) :
   QObject(parent),
   manager_(0),
@@ -93,9 +93,9 @@ QString UpgradeCheck::getCpuArchitecture()
 }
 
 UpgradeCheck::updateStatus UpgradeCheck::checkForUpgrade(
-               const QString &currentVersionIn,
-               const QDateTime &lastCheckTime,
-               bool allowBeta)
+  const QString& currentVersionIn,
+  const QDateTime& lastCheckTime,
+  bool allowBeta)
 {
   currentVersion_ = currentVersionIn;
   currentVersion_.remove("GPSBabel Version ");
@@ -139,13 +139,16 @@ UpgradeCheck::updateStatus UpgradeCheck::checkForUpgrade(
     int rc = formatList_[i].getReadUseCount();
     int wc = formatList_[i].getWriteUseCount();
     QString formatName = formatList_[i].getName();
-    if (rc)
+    if (rc) {
       args += QString("&uc%1=rd/%2/%3").arg(j++).arg(formatName).arg(rc);
-    if (wc)
+    }
+    if (wc) {
       args += QString("&uc%1=wr/%2/%3").arg(j++).arg(formatName).arg(wc);
+    }
   }
-  if (j && babelData_.reportStatistics_)
+  if (j && babelData_.reportStatistics_) {
     args += QString("&uc=%1").arg(j);
+  }
 
   if (false && testing) {
     qDebug() << "Posting " << args;
@@ -156,28 +159,30 @@ UpgradeCheck::updateStatus UpgradeCheck::checkForUpgrade(
   return UpgradeCheck::updateUnknown;
 }
 
-QDateTime UpgradeCheck::getUpgradeWarningTime() {
+QDateTime UpgradeCheck::getUpgradeWarningTime()
+{
   return upgradeWarningTime_;
 }
 
-UpgradeCheck::updateStatus UpgradeCheck::getStatus() {
+UpgradeCheck::updateStatus UpgradeCheck::getStatus()
+{
   return updateStatus_;
 }
 
 void UpgradeCheck::httpRequestFinished(QNetworkReply* reply)
 {
 
-  if (reply == 0 ) {
+  if (reply == 0) {
     babelData_.upgradeErrors_++;
     return;
   } else if (reply != replyId_) {
     QMessageBox::information(0, tr("HTTP"),
-           tr("Unexpected reply."));
-  } else if (reply->error() != QNetworkReply::NoError ) {
+                             tr("Unexpected reply."));
+  } else if (reply->error() != QNetworkReply::NoError) {
     babelData_.upgradeErrors_++;
     QMessageBox::information(0, tr("HTTP"),
-           tr("Download failed: %1.")
-           .arg(reply->errorString()));
+                             tr("Download failed: %1.")
+                             .arg(reply->errorString()));
     replyId_ = 0;
     reply->deleteLater();
     return;
@@ -210,9 +215,9 @@ void UpgradeCheck::httpRequestFinished(QNetworkReply* reply)
   if (statusCode != 200) {
     QVariant reason = reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute);
     QMessageBox::information(0, tr("HTTP"),
-           tr("Download failed: %1: %2.")
-           .arg(statusCode.toInt())
-           .arg(reason.toString()));
+                             tr("Download failed: %1: %2.")
+                             .arg(statusCode.toInt())
+                             .arg(reason.toString()));
     replyId_ = 0;
     reply->deleteLater();
     return;
@@ -227,9 +232,9 @@ void UpgradeCheck::httpRequestFinished(QNetworkReply* reply)
   // This shouldn't ever be seen by a user.
   if (!document.setContent(oresponse, &error_text, &line)) {
     QMessageBox::critical(0, tr("Error"),
-           tr("Invalid return data at line %1: %2.")
-           .arg(line)
-           .arg( error_text));
+                          tr("Invalid return data at line %1: %2.")
+                          .arg(line)
+                          .arg(error_text));
     babelData_.upgradeErrors_++;
     replyId_ = 0;
     reply->deleteLater();
@@ -239,8 +244,9 @@ void UpgradeCheck::httpRequestFinished(QNetworkReply* reply)
   QString response;
   QString upgradeText;
 
-  if (testing)
-    currentVersion_ =  "1.3.1"; // for testing
+  if (testing) {
+    currentVersion_ =  "1.3.1";  // for testing
+  }
 
   bool allowBeta = true;  // TODO: come from prefs or current version...
 
@@ -265,13 +271,13 @@ void UpgradeCheck::httpRequestFinished(QNetworkReply* reply)
     upgradeText = upgrade.firstChildElement("overview").text();
 
     // String compare, not a numeric one.  Server will return "best first".
-    if((updateVersion > currentVersion_) && updateCandidate) {
+    if ((updateVersion > currentVersion_) && updateCandidate) {
       babelData_.upgradeOffers_++;
       updateStatus_ = updateNeeded;
       response = tr("A new version of GPSBabel is available.<br />"
-        "Your version is %1 <br />"
-        "The latest version is %2")
-          .arg(currentVersion_, updateVersion);
+                    "Your version is %1 <br />"
+                    "The latest version is %2")
+                 .arg(currentVersion_, updateVersion);
       break;
     }
   }
@@ -290,20 +296,21 @@ void UpgradeCheck::httpRequestFinished(QNetworkReply* reply)
     information.setDetailedText(upgradeText);
 
     switch (information.exec()) {
-      case QMessageBox::Yes:
-        // downloadUrl.addQueryItem("os", getOsName());
-        QDesktopServices::openUrl(downloadUrl);
-        babelData_.upgradeAccept_++;
-        break;
-      default: ;
-        babelData_.upgradeDeclines_++;
+    case QMessageBox::Yes:
+      // downloadUrl.addQueryItem("os", getOsName());
+      QDesktopServices::openUrl(downloadUrl);
+      babelData_.upgradeAccept_++;
+      break;
+    default:
+      ;
+      babelData_.upgradeDeclines_++;
     }
   }
 
   upgradeWarningTime_ = QDateTime(QDateTime::currentDateTime());
 
   for (int i = 0; i < formatList_.size(); i++) {
-     formatList_[i].zeroUseCounts();
+    formatList_[i].zeroUseCounts();
   }
   replyId_ = 0;
   reply->deleteLater();
index 05c33864910b40ac1ec169f5f121ea1591e3611c..a0e7b6fc9ec63b85139b6ebff6866de84a94b4e9 100644 (file)
 class QNetworkAccessManager;
 class QNetworkReply;
 
-class UpgradeCheck : public QObject {
+class UpgradeCheck : public QObject
+{
   Q_OBJECT
 public:
-  UpgradeCheck(QWidget *parent, QList<Format> &formatList, BabelData& bd);
+  UpgradeCheck(QWidget* parent, QList<Format>& formatList, BabelData& bd);
   ~UpgradeCheck();
 
   typedef enum {
@@ -39,8 +40,8 @@ public:
     updateNeeded,
   } updateStatus;
 
-  UpgradeCheck::updateStatus checkForUpgrade(const QString &babelVersion,
-      const QDateTime &lastCheckTime,
+  UpgradeCheck::updateStatus checkForUpgrade(const QStringbabelVersion,
+      const QDateTimelastCheckTime,
       bool allowBeta);
   QDateTime getUpgradeWarningTime(void);
   UpgradeCheck::updateStatus getStatus(void);
@@ -55,7 +56,7 @@ private:
   QUrl upgradeUrl_;
   QString latestVersion_;
   QDateTime upgradeWarningTime_;  // invalid time if this object never issued.
-  QList<Format> &formatList_;
+  QList<Format>formatList_;
   updateStatus updateStatus_;
   BabelData& babelData_;
 
index 2a34ba8350ce9800805dd793da7491276df12793..5a5445acf7fd4b62891aec96a835f85bf2926eda 100644 (file)
@@ -21,8 +21,8 @@
 
 #include "version_mismatch.h"
 
-VersionMismatch::VersionMismatch(QWidget *parent, const QString &ver1,
-                                 const QString &ver2): QDialog(parent)
+VersionMismatch::VersionMismatch(QWidget* parent, const QString& ver1,
+                                 const QStringver2): QDialog(parent)
 {
   ui_.setupUi(this);
 
index a9b8b0afc823b243e122f8996b7668b4cbeee230..f616f78372de4c9a2c312786198f9c2acc81a485 100644 (file)
 
 #include "ui_version_mismatch.h"
 
-class VersionMismatch: public QDialog {
- public:
-  VersionMismatch(QWidget *parent,  const QString &ver1,
-                 const QString &ver2);
-  bool neverAgain() { return ui_.neverAgain->isChecked(); }
+class VersionMismatch: public QDialog
+{
+public:
+  VersionMismatch(QWidget* parent,  const QString& ver1,
+                  const QString& ver2);
+  bool neverAgain()
+  {
+    return ui_.neverAgain->isChecked();
+  }
 
- private:
+private:
   Ui_VersionMismatch  ui_;
 };